From 269eb9fa3e843de9b87cb547d073e458920fdfbd Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Wed, 31 Oct 2018 22:25:01 +0100 Subject: [PATCH] Implemented test and interface for toString entity toString method --- application/src/Entity/EntityInterface.php | 6 ++++++ application/tests/Unit/Entity/AbstractEntityTest.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/application/src/Entity/EntityInterface.php b/application/src/Entity/EntityInterface.php index 2d66f70..b10114d 100644 --- a/application/src/Entity/EntityInterface.php +++ b/application/src/Entity/EntityInterface.php @@ -10,4 +10,10 @@ use App\Entity\Attribut\IdAttributInterface; */ interface EntityInterface extends VersionAttributInterface, IdAttributInterface { + /** + * Allows easier debuging. + * + * @return string + */ + public function __toString(): string; } diff --git a/application/tests/Unit/Entity/AbstractEntityTest.php b/application/tests/Unit/Entity/AbstractEntityTest.php index 7f1fa4f..9e10942 100644 --- a/application/tests/Unit/Entity/AbstractEntityTest.php +++ b/application/tests/Unit/Entity/AbstractEntityTest.php @@ -39,4 +39,9 @@ class AbstractEntityTest extends TestCase $this->assertNull($this->entity->setId($id)); $this->assertEquals($id, $this->entity->getId()); } + + public function testToString(): void + { + $this->assertEquals(true, is_string($this->entity->__toString())); + } }