2018-10-28 20:28:29 +01:00
|
|
|
<?php
|
2018-10-29 19:01:00 +01:00
|
|
|
|
2018-10-28 20:28:29 +01:00
|
|
|
namespace tests\unit\Entity\Source;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use App\Entity\Source\SourceInterface;
|
|
|
|
use App\Entity\Meta\LawInterface;
|
|
|
|
use App\Entity\Meta\RelationInterface;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
2018-10-28 22:43:35 +01:00
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use App\Entity\Source\AbstractSource;
|
2018-10-28 20:28:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class AbstractSourceTest extends TestCase
|
|
|
|
{
|
|
|
|
const ID = 123;
|
|
|
|
/**
|
|
|
|
* @var SourceInterface
|
|
|
|
*/
|
|
|
|
protected $source;
|
2018-10-29 19:01:00 +01:00
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->source = new class() extends \App\Entity\Source\AbstractSource {
|
|
|
|
};
|
2018-10-28 20:28:29 +01:00
|
|
|
$this->source->setId(self::ID);
|
|
|
|
}
|
2018-10-29 19:01:00 +01:00
|
|
|
|
|
|
|
public function testId()
|
|
|
|
{
|
|
|
|
$this->assertEquals($this->source->getId(), self::ID);
|
2018-10-28 20:28:29 +01:00
|
|
|
}
|
2018-10-29 19:01:00 +01:00
|
|
|
|
|
|
|
public function testLaw()
|
|
|
|
{
|
|
|
|
$this->assertInstanceOf(LawInterface::class, $this->source->getLaw());
|
2018-10-28 20:28:29 +01:00
|
|
|
}
|
2018-10-29 19:01:00 +01:00
|
|
|
|
|
|
|
public function testRelation()
|
|
|
|
{
|
|
|
|
$this->assertInstanceOf(RelationInterface::class, $this->source->getRelation());
|
2018-10-28 20:28:29 +01:00
|
|
|
}
|
2018-10-29 19:01:00 +01:00
|
|
|
|
|
|
|
public function testGroups()
|
|
|
|
{
|
|
|
|
$this->assertInstanceOf(Collection::class, $this->source->getGroupSources());
|
|
|
|
$group = new class() extends AbstractSource {
|
|
|
|
};
|
2018-10-28 22:43:35 +01:00
|
|
|
$groups = new ArrayCollection([$group]);
|
|
|
|
$this->source->setGroupSources($groups);
|
|
|
|
$this->assertEquals($group, $this->source->getGroupSources()->get(0));
|
2018-10-28 20:28:29 +01:00
|
|
|
}
|
|
|
|
}
|