infinito/application/symfony/tests/Unit/Attribut/LayerAttributTest.php

44 lines
1.1 KiB
PHP
Raw Normal View History

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 Infinito\Attribut\LayerAttribut;
2020-04-02 21:13:35 +02:00
use Infinito\Attribut\LayerAttributInterface;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Exception\Type\InvalidChoiceTypeException;
2020-04-02 21:13:35 +02:00
use PHPUnit\Framework\TestCase;
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
{
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
}
$this->expectException(InvalidChoiceTypeException::class);
2019-01-16 21:47:41 +01:00
$this->layerAttribut->setLayer('NoneValidLayer');
2018-11-06 22:42:24 +01:00
}
}