From cd3585c3e33f5e6199cb12d01a9e667d2b27cc27 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 4 Nov 2018 23:51:33 +0100 Subject: [PATCH] Removed deprecated trait,interface and test --- .../src/Entity/Attribut/MembersAttribut.php | 46 -------- .../Attribut/MembersAttributInterface.php | 28 ----- .../Entity/Attribut/MembersAttributTest.php | 108 ------------------ 3 files changed, 182 deletions(-) delete mode 100644 application/src/Entity/Attribut/MembersAttribut.php delete mode 100644 application/src/Entity/Attribut/MembersAttributInterface.php delete mode 100644 application/tests/Unit/Entity/Attribut/MembersAttributTest.php diff --git a/application/src/Entity/Attribut/MembersAttribut.php b/application/src/Entity/Attribut/MembersAttribut.php deleted file mode 100644 index 2efbb89..0000000 --- a/application/src/Entity/Attribut/MembersAttribut.php +++ /dev/null @@ -1,46 +0,0 @@ -collection; - } - - public function setMembers(Collection $members): void - { - $this->collection = $members; - } - - /** - * @param int $dimension The dimensions start with 1 for the members of the actuall dimension and NULL for all members - * @param Collection $members A reference to a members list, to which new members should be add - * - * @deprecated Use Instead CollectionDimensionHelperMethod - * - * @return Collection|MembersAttributInterface[] Returns all members till the defined dimension - */ - public function getMembersIncludingChildren(?int $dimension = null, Collection $members = null): Collection - { - $dimensionHelper = new DimensionHelper(__FUNCTION__, MembersAttributInterface::class, $this, 'members'); - - return $dimensionHelper->getDimensions($dimension, $members); - } -} diff --git a/application/src/Entity/Attribut/MembersAttributInterface.php b/application/src/Entity/Attribut/MembersAttributInterface.php deleted file mode 100644 index f2488f1..0000000 --- a/application/src/Entity/Attribut/MembersAttributInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -membersAttribut = $this->getMembersAttributClassMock(); - } - - private function getMembersAttributClassMock(): MembersAttributInterface - { - return new class() implements MembersAttributInterface { - use MembersAttribut; - }; - } - - public function testConstructor(): void - { - $this->expectException(\TypeError::class); - $this->membersAttribut->getMembers(); - $this->membersAttribut->getMembersIncludingChildren(); - } - - public function testMembersAccessors() - { - $source1 = $this->createMock(SourceInterface::class); - $source2 = clone $source1; - $source3 = clone $source1; - $members = new ArrayCollection([ - $source1, - $source2, - $source3, - ]); - $this->assertNull($this->membersAttribut->setMembers($members)); - $this->assertEquals($members, $this->membersAttribut->getMembers()); - $this->assertTrue($this->membersAttribut->getMembers()->contains($source1)); - } - - public function testFirstLevelMembersInclusiveChildren(): void - { - $source1 = $this->getMembersAttributClassMock(); - $source2 = clone $source1; - $source3 = clone $source1; - $source4 = clone $source1; - $source3->setMembers(new ArrayCollection([$source4])); - $members = new ArrayCollection([$source1, $source2, $source3]); - $this->assertNull($this->membersAttribut->setMembers($members)); - $this->assertEquals(3, $this->membersAttribut->getMembersIncludingChildren(1)->count()); - } - - public function test3DimensionsMembersInclusiveChildren(): void - { - $source1 = $this->getMembersAttributClassMock(); - $source2 = clone $source1; - $source3 = clone $source1; - $source4 = clone $source1; - $source1->setMembers(new ArrayCollection([$source2])); - $source2->setMembers(new ArrayCollection([$source3])); - $source3->setMembers(new ArrayCollection([$source4])); - $source4->setMembers(new ArrayCollection()); - $this->membersAttribut->setMembers(new ArrayCollection([$source1])); - $this->assertEquals(1, $this->membersAttribut->getMembers()->count()); - $this->assertEquals(1, $source1->getMembers()->count()); - $this->assertEquals(1, $source2->getMembers()->count()); - $this->assertEquals(1, $source3->getMembers()->count()); - $this->assertEquals(0, $source4->getMembers()->count()); - $this->assertEquals(3, $this->membersAttribut->getMembersIncludingChildren(3)->count()); - } - - public function testMembersIncludingChildrenInfinite(): void - { - $source1 = $this->getMembersAttributClassMock(); - $source1->setMembers(new ArrayCollection()); - $source2 = clone $source1; - $source3 = clone $source1; - $source4 = clone $source1; - $source5 = clone $source1; - $source6 = clone $source1; - $source1->setMembers(new ArrayCollection([$source2])); - $source2->setMembers(new ArrayCollection([$source1, $source3])); - $source3->setMembers(new ArrayCollection([$source4])); - $source4->setMembers(new ArrayCollection([$source5])); - $source5->setMembers(new ArrayCollection([$source6])); - - $this->membersAttribut->setMembers(new ArrayCollection([$source1])); - $this->assertEquals(6, $this->membersAttribut->getMembersIncludingChildren()->count()); - } - - public function testMemberWithoutMembers(): void - { - $source1 = $this->createMock(SourceInterface::class); - $this->membersAttribut->setMembers(new ArrayCollection([$source1])); - $this->assertEquals(1, $this->membersAttribut->getMembersIncludingChildren()->count()); - } -}