diff --git a/application/src/Entity/Source/Collection/TreeCollectionSource.php b/application/src/Entity/Source/Collection/TreeCollectionSource.php index e98397d..96d455f 100644 --- a/application/src/Entity/Source/Collection/TreeCollectionSource.php +++ b/application/src/Entity/Source/Collection/TreeCollectionSource.php @@ -13,7 +13,7 @@ use App\Entity\Method\CollectionDimensionHelperMethod; * @ORM\Table(name="source_group") * @ORM\Entity */ -final class TreeCollectionSource extends AbstractCollectionSource implements TreeCollectionSourceInterface +class TreeCollectionSource extends AbstractCollectionSource implements TreeCollectionSourceInterface { use MembersAttribut; use CollectionDimensionHelperMethod; diff --git a/application/src/Entity/Source/Data/UserSource.php b/application/src/Entity/Source/Data/UserSource.php index e961041..9185c89 100644 --- a/application/src/Entity/Source/Data/UserSource.php +++ b/application/src/Entity/Source/Data/UserSource.php @@ -13,7 +13,7 @@ use App\Entity\UserInterface; * @ORM\Table(name="source_data_user") * @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository") */ -final class UserSource extends AbstractDataSource implements UserSourceInterface +class UserSource extends AbstractDataSource implements UserSourceInterface { use UserAttribut,NameSourceAttribut; diff --git a/application/tests/Unit/Entity/Meta/RecieverTest.php b/application/tests/Unit/Entity/Meta/RecieverTest.php index db99af0..2e4b0f2 100644 --- a/application/tests/Unit/Entity/Meta/RecieverTest.php +++ b/application/tests/Unit/Entity/Meta/RecieverTest.php @@ -6,6 +6,10 @@ use PHPUnit\Framework\TestCase; use App\Entity\Meta\Reciever; use App\Entity\Meta\RecieverInterface; use Doctrine\Common\Collections\Collection; +use App\Entity\Source\Data\UserSource; +use App\Entity\Source\Collection\TreeCollectionSource; +use App\Entity\Source\Collection\TreeCollectionSourceInterface; +use App\Entity\Source\Data\UserSourceInterface; class RecieverTest extends TestCase { @@ -25,4 +29,38 @@ class RecieverTest extends TestCase $this->expectException(\TypeError::class); $this->reciever->getRight(); } + + public function testMembersIncludingChildren(): void + { + /** + * @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface + */ + $user1 = $this->createMock(UserSource::class); + /** + * @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface + */ + $user2 = $this->createMock(UserSource::class); + /** + * @var \PHPUnit\Framework\MockObject\MockObject|UserSourceInterface + */ + $user3 = $this->createMock(UserSource::class); + /** + * @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface + */ + $group1 = $this->createMock(TreeCollectionSource::class); + /** + * @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface + */ + $group2 = $this->createMock(TreeCollectionSource::class); + /** + * @var \PHPUnit\Framework\MockObject\MockObject|TreeCollectionSourceInterface + */ + $group3 = $this->createMock(TreeCollectionSource::class); + $group1->getCollection()->add($user1); + $group2->getCollection()->add($group1); + $group2->getCollection()->add($user2); + $group2->getCollection()->add($user3); + $group3->getCollection()->add($group2); + $this->assertEquals(6, $this->reciever->getMembersIncludingChildren()->count()); + } } diff --git a/application/tests/Unit/Entity/Meta/RightTest.php b/application/tests/Unit/Entity/Meta/RightTest.php index 9206a64..40b4ab9 100644 --- a/application/tests/Unit/Entity/Meta/RightTest.php +++ b/application/tests/Unit/Entity/Meta/RightTest.php @@ -27,7 +27,7 @@ class RightTest extends TestCase public function testConstructor(): void { - $this->assertEquals($this->right,$this->right->getReciever()->getRight()); + $this->assertEquals($this->right, $this->right->getReciever()->getRight()); $this->expectException(\TypeError::class); $this->assertNull($this->right->getLaw()); $this->expectException(\TypeError::class);