From 6a27c221a8a05309f3a02755d077acb0a984547c Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sat, 29 Dec 2018 23:01:57 +0100 Subject: [PATCH] Implemeted test for clone function --- .../tests/Unit/Entity/Meta/RightTest.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/application/tests/Unit/Entity/Meta/RightTest.php b/application/tests/Unit/Entity/Meta/RightTest.php index 5375729..3ebec38 100644 --- a/application/tests/Unit/Entity/Meta/RightTest.php +++ b/application/tests/Unit/Entity/Meta/RightTest.php @@ -9,6 +9,7 @@ use App\Entity\Meta\Right; use App\Entity\Meta\Law; use App\DBAL\Types\LayerType; use App\Exception\NoValidChoice; +use App\Entity\Source\AbstractSource; /** * @todo Implement reciever test @@ -89,4 +90,27 @@ class RightTest extends TestCase $this->expectException(NoValidChoice::class); $this->right->setLayer('NoneValidLayer'); } + + /** + * Just to test if the clone function works like assumed. + */ + public function testClone(): void + { + $source = $this->createMock(AbstractSource::class); + $reciever = $this->createMock(AbstractSource::class); + $grant = false; + $type = RightType::READ; + $layer = LayerType::SOURCE; + $this->right->setSource($source); + $this->right->setReciever($reciever); + $this->right->setGrant($grant); + $this->right->setType($type); + $this->right->setLayer($layer); + $rightClone = clone $this->right; + $this->assertEquals($source, $rightClone->getSource()); + $this->assertEquals($reciever, $rightClone->getReciever()); + $this->assertEquals($grant, $rightClone->getGrant()); + $this->assertEquals($type, $rightClone->getType()); + $this->assertEquals($layer, $rightClone->getLayer()); + } }