infinito/application/tests/Unit/Entity/Meta/RightTest.php

60 lines
1.3 KiB
PHP
Raw Normal View History

2018-10-31 15:19:24 +01:00
<?php
namespace tests\unit\Entity;
2018-10-31 15:19:24 +01:00
use PHPUnit\Framework\TestCase;
use App\DBAL\Types\RightType;
use App\Entity\Meta\RightInterface;
use App\Entity\Meta\Right;
use App\Entity\Meta\Law;
2018-10-31 15:19:24 +01:00
/**
* @todo Implement reciever test
*
* @author kevinfrantz
*/
class RightTest extends TestCase
{
/**
* @var RightInterface
*/
protected $right;
public function setUp(): void
{
$this->right = new Right();
}
2018-11-06 20:56:54 +01:00
public function testConstructorGeneral(): void
2018-10-31 15:19:24 +01:00
{
2018-11-04 16:12:16 +01:00
$this->assertEquals($this->right, $this->right->getReciever()->getRight());
2018-10-31 15:19:24 +01:00
$this->expectException(\TypeError::class);
$this->assertNull($this->right->getLaw());
2018-11-06 20:56:54 +01:00
}
public function testConstructorCondition()
{
$this->expectException(\TypeError::class);
$this->right->getCondition();
}
public function testConstructorType(): void
{
2018-11-04 15:51:16 +01:00
$this->expectException(\TypeError::class);
2018-10-31 15:19:24 +01:00
$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());
}
}