From cb0e3739b1cf1997cf99c4c5bee9eeb7d58faed4 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 28 Oct 2018 22:43:35 +0100 Subject: [PATCH] Implemented test for NameSource --- .../unit/Entity/Source/AbstractSourceTest.php | 6 ++++ .../unit/Entity/Source/NameSourceTest.php | 34 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 application/tests/unit/Entity/Source/NameSourceTest.php diff --git a/application/tests/unit/Entity/Source/AbstractSourceTest.php b/application/tests/unit/Entity/Source/AbstractSourceTest.php index d371657..06f5135 100644 --- a/application/tests/unit/Entity/Source/AbstractSourceTest.php +++ b/application/tests/unit/Entity/Source/AbstractSourceTest.php @@ -6,6 +6,8 @@ use App\Entity\Source\SourceInterface; use App\Entity\Meta\LawInterface; use App\Entity\Meta\RelationInterface; use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Collections\ArrayCollection; +use App\Entity\Source\AbstractSource; /** * @@ -39,6 +41,10 @@ class AbstractSourceTest extends TestCase public function testGroups(){ $this->assertInstanceOf(Collection::class,$this->source->getGroupSources()); + $group = new class extends AbstractSource{}; + $groups = new ArrayCollection([$group]); + $this->source->setGroupSources($groups); + $this->assertEquals($group, $this->source->getGroupSources()->get(0)); } } diff --git a/application/tests/unit/Entity/Source/NameSourceTest.php b/application/tests/unit/Entity/Source/NameSourceTest.php new file mode 100644 index 0000000..a7d3305 --- /dev/null +++ b/application/tests/unit/Entity/Source/NameSourceTest.php @@ -0,0 +1,34 @@ +nameSource = new NameSource(); + } + + public function testName():void{ + $this->assertEquals('', $this->nameSource->getName()); + $name = 'Hello World!'; + $this->nameSource->setName($name); + $this->assertEquals($name, $this->nameSource->getName()); + } +} +