mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Implemented test for Right
This commit is contained in:
parent
5e6b8bccbe
commit
09cfcebb92
@ -83,8 +83,6 @@ final class Right extends AbstractMeta implements RightInterface
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->grant = true;
|
$this->grant = true;
|
||||||
//$this->node = new Node();
|
|
||||||
//$this->recieverGroup = new RecieverGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
||||||
|
44
application/tests/unit/Entity/Meta/RightTest.php
Normal file
44
application/tests/unit/Entity/Meta/RightTest.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity\Meta;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use App\DBAL\Types\RightType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo Implement reciever test
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class RightTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RightInterface
|
||||||
|
*/
|
||||||
|
protected $right;
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
$this->right = new Right();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructor(): void
|
||||||
|
{
|
||||||
|
$this->expectException(\TypeError::class);
|
||||||
|
$this->assertNull($this->right->getLaw());
|
||||||
|
$this->assertNull($this->right->getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLaw(): void
|
||||||
|
{
|
||||||
|
$law = new Law();
|
||||||
|
$this->assertNull($this->right->setLaw($law));
|
||||||
|
$this->assertEquals($law, $this->right->getLaw());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRight(): void
|
||||||
|
{
|
||||||
|
$this->assertNull($this->right->setType(RightType::READ));
|
||||||
|
$this->assertEquals(RightType::READ, $this->right->getType());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user