mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 14:27:28 +01:00
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Attribut;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Infinito\Attribut\CrudAttributInterface;
|
|
use Infinito\Attribut\CrudAttribut;
|
|
use Infinito\DBAL\Types\Meta\Right\CRUDType;
|
|
use Infinito\Exception\Type\InvalidChoiceTypeException;
|
|
|
|
/**
|
|
* @author kevinfrantz
|
|
*/
|
|
class CrudAttributTest extends TestCase
|
|
{
|
|
/**
|
|
* @var CrudAttributInterface
|
|
*/
|
|
protected $crudAttribut;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->crudAttribut = new class() implements CrudAttributInterface {
|
|
use CrudAttribut;
|
|
};
|
|
}
|
|
|
|
public function testConstructor(): void
|
|
{
|
|
$this->expectException(\TypeError::class);
|
|
$this->crudAttribut->getCrud();
|
|
}
|
|
|
|
public function testAccessors(): void
|
|
{
|
|
foreach (CRUDType::getValues() as $enum) {
|
|
$this->assertNull($this->crudAttribut->setCrud($enum));
|
|
$this->assertEquals($enum, $this->crudAttribut->getCrud());
|
|
}
|
|
$this->expectException(InvalidChoiceTypeException::class);
|
|
$this->crudAttribut->setCrud('NoneValidType');
|
|
}
|
|
}
|