mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
General optimation of tests and namespaces
This commit is contained in:
36
application/tests/Unit/Entity/Meta/LawTest.php
Normal file
36
application/tests/Unit/Entity/Meta/LawTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Entity\Meta;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Meta\LawInterface;
|
||||
use App\Entity\Meta\Law;
|
||||
use App\Entity\Meta\Right;
|
||||
|
||||
class LawTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var LawInterface
|
||||
*/
|
||||
protected $law;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->law = new Law();
|
||||
}
|
||||
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$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));
|
||||
}
|
||||
}
|
26
application/tests/Unit/Entity/Meta/RecieverTest.php
Normal file
26
application/tests/Unit/Entity/Meta/RecieverTest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\tests\unit\Entity\Meta;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Entity\Meta\Reciever;
|
||||
use App\Entity\Meta\RecieverInterface;
|
||||
|
||||
class RecieverTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var RecieverInterface
|
||||
*/
|
||||
public $reciever;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->reciever = new Reciever();
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertEquals(Collection::class, $this->reciever->getAllRecievers());
|
||||
}
|
||||
}
|
47
application/tests/Unit/Entity/Meta/RightTest.php
Normal file
47
application/tests/Unit/Entity/Meta/RightTest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Entity;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Entity\Meta\Right;
|
||||
use App\Entity\Meta\Law;
|
||||
|
||||
/**
|
||||
* @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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user