From 9e4b00e2ae9897fe145c41d436cd5951ea43dcd2 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 4 Nov 2018 15:56:40 +0100 Subject: [PATCH] Optimized constructor of right --- application/src/Entity/Meta/Right.php | 1 + application/tests/Unit/Entity/Meta/RightTest.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/Entity/Meta/Right.php b/application/src/Entity/Meta/Right.php index 5afc017..e7d87a8 100644 --- a/application/src/Entity/Meta/Right.php +++ b/application/src/Entity/Meta/Right.php @@ -77,6 +77,7 @@ final class Right extends AbstractMeta implements RightInterface parent::__construct(); $this->grant = true; $this->reciever = new Reciever(); + $this->reciever->setRight($this); } public function isGranted(SourceInterface $source, string $layer, string $right): bool diff --git a/application/tests/Unit/Entity/Meta/RightTest.php b/application/tests/Unit/Entity/Meta/RightTest.php index 3431af7..9206a64 100644 --- a/application/tests/Unit/Entity/Meta/RightTest.php +++ b/application/tests/Unit/Entity/Meta/RightTest.php @@ -7,7 +7,6 @@ use App\DBAL\Types\RightType; use App\Entity\Meta\RightInterface; use App\Entity\Meta\Right; use App\Entity\Meta\Law; -use App\Entity\Meta\RecieverInterface; /** * @todo Implement reciever test @@ -28,7 +27,7 @@ class RightTest extends TestCase public function testConstructor(): void { - $this->assertInstanceOf(RecieverInterface::class, $this->right->getReciever()); + $this->assertEquals($this->right,$this->right->getReciever()->getRight()); $this->expectException(\TypeError::class); $this->assertNull($this->right->getLaw()); $this->expectException(\TypeError::class);