2018-10-31 14:28:32 +01:00
|
|
|
<?php
|
|
|
|
|
2018-10-31 16:15:39 +01:00
|
|
|
namespace tests\unit\Entity\Meta;
|
2018-10-31 14:28:32 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Meta\LawInterface;
|
|
|
|
use Infinito\Entity\Meta\Law;
|
|
|
|
use Infinito\Entity\Meta\Right;
|
2018-10-31 14:28:32 +01:00
|
|
|
|
|
|
|
class LawTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var LawInterface
|
|
|
|
*/
|
|
|
|
protected $law;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->law = new Law();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstruct(): void
|
|
|
|
{
|
2019-01-01 21:33:13 +01:00
|
|
|
$this->assertFalse($this->law->getGrant());
|
2018-10-31 14:28:32 +01:00
|
|
|
$this->assertInstanceOf(Collection::class, $this->law->getRights());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRights(): void
|
|
|
|
{
|
|
|
|
$right = new Right();
|
|
|
|
$rights = new ArrayCollection([$right, new Right(), new Right()]);
|
|
|
|
$this->assertNull($this->law->setRights($rights));
|
|
|
|
$this->assertEquals($right, $this->law->getRights()->get(0));
|
|
|
|
}
|
|
|
|
}
|