mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Implemented tests for LayerType
This commit is contained in:
parent
0bc9ca20a9
commit
b13ca37959
@ -9,14 +9,14 @@ use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
|
|||||||
*/
|
*/
|
||||||
final class LayerType extends AbstractEnumType
|
final class LayerType extends AbstractEnumType
|
||||||
{
|
{
|
||||||
public const NODE = 'node';
|
public const RELATION = 'relation';
|
||||||
|
|
||||||
public const SOURCE = 'source';
|
public const SOURCE = 'source';
|
||||||
|
|
||||||
public const LAW = 'law';
|
public const LAW = 'law';
|
||||||
|
|
||||||
protected static $choices = [
|
protected static $choices = [
|
||||||
self::NODE => 'node',
|
self::RELATION => 'relation',
|
||||||
self::LAW => 'law',
|
self::LAW => 'law',
|
||||||
self::SOURCE => 'source',
|
self::SOURCE => 'source',
|
||||||
];
|
];
|
||||||
|
41
application/tests/Unit/Entity/Attribut/LayerAttributTest.php
Normal file
41
application/tests/Unit/Entity/Attribut/LayerAttributTest.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit\Entity\Attribut;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use App\Entity\Attribut\LayerAttributInterface;
|
||||||
|
use App\Entity\Attribut\LayerAttribut;
|
||||||
|
use App\DBAL\Types\LayerType;
|
||||||
|
|
||||||
|
class LayerAttributTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var LayerAttributInterface
|
||||||
|
*/
|
||||||
|
protected $layer;
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
$this->layer = new class() implements LayerAttributInterface {
|
||||||
|
use LayerAttribut;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstruct(): void
|
||||||
|
{
|
||||||
|
$this->expectException(\TypeError::class);
|
||||||
|
$this->layer->getLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAccessors(): void
|
||||||
|
{
|
||||||
|
foreach ([
|
||||||
|
LayerType::LAW,
|
||||||
|
LayerType::RELATION,
|
||||||
|
LayerType::SOURCE,
|
||||||
|
] as $value) {
|
||||||
|
$this->assertNull($this->layer->setLayer($value));
|
||||||
|
$this->assertEquals($value, $this->layer->getLayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,11 +29,21 @@ class RightTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->assertEquals($this->right, $this->right->getReciever()->getRight());
|
$this->assertEquals($this->right, $this->right->getReciever()->getRight());
|
||||||
$this->assertTrue($this->right->getGrant());
|
$this->assertTrue($this->right->getGrant());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorLayer(): void
|
||||||
|
{
|
||||||
|
$this->expectException(\TypeError::class);
|
||||||
|
$this->assertNull($this->right->getLayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorLaw(): void
|
||||||
|
{
|
||||||
$this->expectException(\TypeError::class);
|
$this->expectException(\TypeError::class);
|
||||||
$this->assertNull($this->right->getLaw());
|
$this->assertNull($this->right->getLaw());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConstructorCondition()
|
public function testConstructorCondition(): void
|
||||||
{
|
{
|
||||||
$this->expectException(\TypeError::class);
|
$this->expectException(\TypeError::class);
|
||||||
$this->right->getCondition();
|
$this->right->getCondition();
|
||||||
|
Loading…
Reference in New Issue
Block a user