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 PHPUnit\Framework\TestCase;
2019-01-20 10:41:58 +01:00
use App\Attribut\LayerAttributInterface;
use App\Attribut\LayerAttribut;
2019-01-05 17:27:40 +01:00
use App\DBAL\Types\Meta\Right\LayerType;
2019-01-16 21:47:41 +01:00
use App\Exception\NoValidChoiceException;
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-01-16 21:47:41 +01:00
foreach (LayerType::getChoices() as $enum) {
$this->assertNull($this->layerAttribut->setLayer($enum));
$this->assertEquals($enum, $this->layerAttribut->getLayer());
2018-11-06 22:42:24 +01:00
}
2019-01-16 21:47:41 +01:00
$this->expectException(NoValidChoiceException::class);
$this->layerAttribut->setLayer('NoneValidLayer');
2018-11-06 22:42:24 +01:00
}
}