2018-11-06 22:42:24 +01:00
|
|
|
<?php
|
|
|
|
|
2019-01-20 10:41:58 +01:00
|
|
|
namespace Tests\Unit\Attribut;
|
2018-11-06 22:42:24 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Attribut\LayerAttributInterface;
|
|
|
|
use Infinito\Attribut\LayerAttribut;
|
|
|
|
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
2019-04-14 23:37:30 +02:00
|
|
|
use Infinito\Exception\Type\InvalidChoiceTypeException;
|
2018-11-06 22:42:24 +01:00
|
|
|
|
2019-01-16 21:47:41 +01:00
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
2018-11-06 22:42:24 +01:00
|
|
|
class LayerAttributTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var LayerAttributInterface
|
|
|
|
*/
|
2019-01-16 21:47:41 +01:00
|
|
|
protected $layerAttribut;
|
2018-11-06 22:42:24 +01:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
2019-01-16 21:47:41 +01:00
|
|
|
$this->layerAttribut = new class() implements LayerAttributInterface {
|
2018-11-06 22:42:24 +01:00
|
|
|
use LayerAttribut;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstruct(): void
|
|
|
|
{
|
|
|
|
$this->expectException(\TypeError::class);
|
2019-01-16 21:47:41 +01:00
|
|
|
$this->layerAttribut->getLayer();
|
2018-11-06 22:42:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testAccessors(): void
|
|
|
|
{
|
2019-02-25 13:32:37 +01:00
|
|
|
foreach (LayerType::getValues() as $enum) {
|
2019-01-16 21:47:41 +01:00
|
|
|
$this->assertNull($this->layerAttribut->setLayer($enum));
|
|
|
|
$this->assertEquals($enum, $this->layerAttribut->getLayer());
|
2018-11-06 22:42:24 +01:00
|
|
|
}
|
2019-04-14 23:37:30 +02:00
|
|
|
$this->expectException(InvalidChoiceTypeException::class);
|
2019-01-16 21:47:41 +01:00
|
|
|
$this->layerAttribut->setLayer('NoneValidLayer');
|
2018-11-06 22:42:24 +01:00
|
|
|
}
|
|
|
|
}
|