Renamed TypeAttribut to CrudAttribut

This commit is contained in:
Kevin Frantz
2019-01-16 21:22:18 +01:00
parent 665f0044cc
commit 93bf246915
28 changed files with 113 additions and 107 deletions

View File

@@ -3,36 +3,36 @@
namespace Tests\Unit\Entity\Attribut;
use PHPUnit\Framework\TestCase;
use App\Entity\Attribut\TypeAttributInterface;
use App\Entity\Attribut\TypeAttribut;
use App\Entity\Attribut\CrudAttributInterface;
use App\Entity\Attribut\CrudAttribut;
/**
* @author kevinfrantz
*/
class TypeAttributTest extends TestCase
class CrudAttributTest extends TestCase
{
/**
* @var TypeAttributInterface
* @var CrudAttributInterface
*/
protected $typeAttribut;
public function setUp(): void
{
$this->typeAttribut = new class() implements TypeAttributInterface {
use TypeAttribut;
$this->typeAttribut = new class() implements CrudAttributInterface {
use CrudAttribut;
};
}
public function testConstructor(): void
{
$this->expectException(\TypeError::class);
$this->typeAttribut->getType();
$this->typeAttribut->getCrud();
}
public function testAccessors(): void
{
$type = 'Hello World!';
$this->assertNull($this->typeAttribut->setType($type));
$this->assertEquals($type, $this->typeAttribut->getType());
$this->assertNull($this->typeAttribut->setCrud($type));
$this->assertEquals($type, $this->typeAttribut->getCrud());
}
}

View File

@@ -61,7 +61,7 @@ class RightTest extends TestCase
public function testConstructorType(): void
{
$this->expectException(\TypeError::class);
$this->assertNull($this->right->getType());
$this->assertNull($this->right->getCrud());
}
public function testLaw(): void
@@ -74,11 +74,11 @@ class RightTest extends TestCase
public function testRight(): void
{
foreach (CRUDType::getChoices() as $key => $value) {
$this->assertNull($this->right->setType($key));
$this->assertEquals($key, $this->right->getType());
$this->assertNull($this->right->setCrud($key));
$this->assertEquals($key, $this->right->getCrud());
}
$this->expectException(NoValidChoiceException::class);
$this->right->setType('NoneValidType');
$this->right->setCrud('NoneValidType');
}
public function testLayer(): void
@@ -104,13 +104,13 @@ class RightTest extends TestCase
$this->right->setSource($source);
$this->right->setReciever($reciever);
$this->right->setGrant($grant);
$this->right->setType($type);
$this->right->setCrud($type);
$this->right->setLayer($layer);
$rightClone = clone $this->right;
$this->assertEquals($source, $rightClone->getSource());
$this->assertEquals($reciever, $rightClone->getReciever());
$this->assertEquals($grant, $rightClone->getGrant());
$this->assertEquals($type, $rightClone->getType());
$this->assertEquals($type, $rightClone->getCrud());
$this->assertEquals($layer, $rightClone->getLayer());
}
}