From 98a868285fefc0a89bdffb0b09831e23ad97f573 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Wed, 31 Oct 2018 23:11:34 +0100 Subject: [PATCH] Implemented tests for relation attribute trait --- .../Entity/Attribut/RelationAttributTest.php | 30 +++++++++++++++++++ .../Unit/Entity/Source/AbstractSourceTest.php | 10 +++---- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 application/tests/Unit/Entity/Attribut/RelationAttributTest.php diff --git a/application/tests/Unit/Entity/Attribut/RelationAttributTest.php b/application/tests/Unit/Entity/Attribut/RelationAttributTest.php new file mode 100644 index 0000000..70f76a4 --- /dev/null +++ b/application/tests/Unit/Entity/Attribut/RelationAttributTest.php @@ -0,0 +1,30 @@ +relationAttribut = new class() implements RelationAttributInterface { + use RelationAttribut; + }; + } + + public function testAccessors(): void + { + $relation = $this->createMock(RelationInterface::class); + $this->assertNull($this->relationAttribut->setRelation($relation)); + $this->assertEquals($relation, $this->relationAttribut->getRelation()); + } +} diff --git a/application/tests/Unit/Entity/Source/AbstractSourceTest.php b/application/tests/Unit/Entity/Source/AbstractSourceTest.php index 0ef3f58..59e22df 100644 --- a/application/tests/Unit/Entity/Source/AbstractSourceTest.php +++ b/application/tests/Unit/Entity/Source/AbstractSourceTest.php @@ -28,6 +28,11 @@ class AbstractSourceTest extends TestCase $this->source->setId(self::ID); } + public function testConstructor(): void + { + $this->assertInstanceOf(RelationInterface::class, $this->source->getRelation()); + } + public function testId() { $this->assertEquals($this->source->getId(), self::ID); @@ -38,11 +43,6 @@ class AbstractSourceTest extends TestCase $this->assertInstanceOf(LawInterface::class, $this->source->getLaw()); } - public function testRelation() - { - $this->assertInstanceOf(RelationInterface::class, $this->source->getRelation()); - } - public function testGroups() { $this->assertInstanceOf(Collection::class, $this->source->getGroupSources());