From d2ffabec14ca68765f1205ac80655c4262290142 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Tue, 6 Nov 2018 22:27:06 +0100 Subject: [PATCH] Implemented Tests for grant attribut --- .../Entity/Attribut/GrantAttributTest.php | 35 +++++++++++++++++++ .../tests/Unit/Entity/Meta/RightTest.php | 1 + 2 files changed, 36 insertions(+) create mode 100644 application/tests/Unit/Entity/Attribut/GrantAttributTest.php diff --git a/application/tests/Unit/Entity/Attribut/GrantAttributTest.php b/application/tests/Unit/Entity/Attribut/GrantAttributTest.php new file mode 100644 index 0000000..24ab05e --- /dev/null +++ b/application/tests/Unit/Entity/Attribut/GrantAttributTest.php @@ -0,0 +1,35 @@ +grant = new class() implements GrantAttributInterface { + use GrantAttribut; + }; + } + + public function testConstruct(): void + { + $this->expectException(\TypeError::class); + $this->grant->getGrant(); + } + + public function testAccessors(): void + { + $grant = true; + $this->assertNull($this->grant->setGrant($grant)); + $this->assertEquals($grant, $this->grant->getGrant()); + } +} diff --git a/application/tests/Unit/Entity/Meta/RightTest.php b/application/tests/Unit/Entity/Meta/RightTest.php index 25bc18e..982e7f3 100644 --- a/application/tests/Unit/Entity/Meta/RightTest.php +++ b/application/tests/Unit/Entity/Meta/RightTest.php @@ -28,6 +28,7 @@ class RightTest extends TestCase public function testConstructorGeneral(): void { $this->assertEquals($this->right, $this->right->getReciever()->getRight()); + $this->assertTrue($this->right->getGrant()); $this->expectException(\TypeError::class); $this->assertNull($this->right->getLaw()); }