Implemented ActionTypeAttribut

This commit is contained in:
Kevin Frantz
2019-01-19 23:15:58 +01:00
parent 4b86acb372
commit 7e9916b27b
4 changed files with 108 additions and 2 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Tests\Unit\Entity\Attribut;
use PHPUnit\Framework\TestCase;
use App\Exception\NoValidChoiceException;
use App\Entity\Attribut\ActionTypeAttributInterface;
use App\Entity\Attribut\ActionTypeAttribut;
use App\DBAL\Types\ActionType;
/**
* @author kevinfrantz
*/
class ActionTypeAttributTest extends TestCase
{
/**
* @var ActionTypeAttributInterface
*/
protected $actionTypeAttribut;
public function setUp(): void
{
$this->actionTypeAttribut = new class() implements ActionTypeAttributInterface {
use ActionTypeAttribut;
};
}
public function testConstructor(): void
{
$this->expectException(\TypeError::class);
$this->actionTypeAttribut->getActionType();
}
public function testAccessors(): void
{
foreach (ActionType::getChoices() as $enum) {
$this->assertNull($this->actionTypeAttribut->setActionType($enum));
$this->assertEquals($enum, $this->actionTypeAttribut->getActionType());
}
$this->expectException(NoValidChoiceException::class);
$this->actionTypeAttribut->setActionType('NoneValidType');
}
}