Implemented tests for relation attribute trait

This commit is contained in:
Kevin Frantz 2018-10-31 23:11:34 +01:00
parent cf625f02a6
commit 98a868285f
2 changed files with 35 additions and 5 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace App\Tests\Unit\Entity\Attribut;
use PHPUnit\Framework\TestCase;
use App\Entity\Meta\RelationInterface;
use App\Entity\Attribut\RelationAttributInterface;
use App\Entity\Attribut\RelationAttribut;
class RelationAttributTest extends TestCase
{
/***
* @var RelationAttributInterface
*/
protected $relationAttribut;
public function setUp(): void
{
$this->relationAttribut = new class() implements RelationAttributInterface {
use RelationAttribut;
};
}
public function testAccessors(): void
{
$relation = $this->createMock(RelationInterface::class);
$this->assertNull($this->relationAttribut->setRelation($relation));
$this->assertEquals($relation, $this->relationAttribut->getRelation());
}
}

View File

@ -28,6 +28,11 @@ class AbstractSourceTest extends TestCase
$this->source->setId(self::ID);
}
public function testConstructor(): void
{
$this->assertInstanceOf(RelationInterface::class, $this->source->getRelation());
}
public function testId()
{
$this->assertEquals($this->source->getId(), self::ID);
@ -38,11 +43,6 @@ class AbstractSourceTest extends TestCase
$this->assertInstanceOf(LawInterface::class, $this->source->getLaw());
}
public function testRelation()
{
$this->assertInstanceOf(RelationInterface::class, $this->source->getRelation());
}
public function testGroups()
{
$this->assertInstanceOf(Collection::class, $this->source->getGroupSources());