Implemented Tests for grant attribut

This commit is contained in:
Kevin Frantz 2018-11-06 22:27:06 +01:00
parent a3d10ac9af
commit d2ffabec14
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace Tests\Unit\Entity\Attribut;
use PHPUnit\Framework\TestCase;
use App\Entity\Attribut\GrantAttribut;
use App\Entity\Attribut\GrantAttributInterface;
class GrantAttributTest extends TestCase
{
/**
* @var GrantAttributInterface
*/
protected $grant;
public function setUp(): void
{
$this->grant = new class() implements GrantAttributInterface {
use GrantAttribut;
};
}
public function testConstruct(): void
{
$this->expectException(\TypeError::class);
$this->grant->getGrant();
}
public function testAccessors(): void
{
$grant = true;
$this->assertNull($this->grant->setGrant($grant));
$this->assertEquals($grant, $this->grant->getGrant());
}
}

View File

@ -28,6 +28,7 @@ class RightTest extends TestCase
public function testConstructorGeneral(): void public function testConstructorGeneral(): void
{ {
$this->assertEquals($this->right, $this->right->getReciever()->getRight()); $this->assertEquals($this->right, $this->right->getReciever()->getRight());
$this->assertTrue($this->right->getGrant());
$this->expectException(\TypeError::class); $this->expectException(\TypeError::class);
$this->assertNull($this->right->getLaw()); $this->assertNull($this->right->getLaw());
} }