Implemented test for NameSourceAttribut

This commit is contained in:
Kevin Frantz 2018-11-04 12:49:42 +01:00
parent 60a071c428
commit 45a1fc6678

View File

@ -0,0 +1,36 @@
<?php
namespace tests\unit\Entity\Attribut;
use PHPUnit\Framework\TestCase;
use App\Entity\Attribut\NameSourceAttributInterface;
use App\Entity\Attribut\NameSourceAttribut;
use App\Entity\Source\Data\NameSourceInterface;
class NameSourceAttributTest extends TestCase
{
/**
* @var NameSourceAttributInterface
*/
protected $name;
public function setUp(): void
{
$this->name = new class() implements NameSourceAttributInterface {
use NameSourceAttribut;
};
}
public function testConstructor(): void
{
$this->expectException(\TypeError::class);
$this->name->getNameSource();
}
public function testAccessors(): void
{
$nameSource = $this->createMock(NameSourceInterface::class);
$this->assertNull($this->name->setNameSource($nameSource));
$this->assertEquals($nameSource, $this->name->getNameSource());
}
}