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 Doctrine\Common\Collections\Collection;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\EntityInterface;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Entity\Meta\LawInterface;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Meta\Relation\Parent\CreatorRelationInterface;
|
|
|
|
use Infinito\Entity\Source\PureSource;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Entity\Source\SourceInterface;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-10-28 20:28:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class AbstractSourceTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var SourceInterface
|
|
|
|
*/
|
|
|
|
protected $source;
|
2018-10-29 19:01:00 +01:00
|
|
|
|
2018-11-24 21:21:59 +01:00
|
|
|
public function setUp()
|
|
|
|
{
|
2019-01-04 22:09:05 +01:00
|
|
|
$this->source = new PureSource();
|
2018-11-24 21:21:59 +01:00
|
|
|
}
|
|
|
|
|
2018-10-31 23:11:34 +01:00
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2018-11-01 20:42:18 +01:00
|
|
|
$this->assertInstanceOf(EntityInterface::class, $this->source);
|
2018-11-25 23:12:42 +01:00
|
|
|
$this->assertInstanceOf(CreatorRelationInterface::class, $this->source->getCreatorRelation());
|
|
|
|
$this->assertEquals($this->source, $this->source->getCreatorRelation()->getSource());
|
2018-11-26 22:36:08 +01:00
|
|
|
$this->assertInstanceOf(Collection::class, $this->source->getMemberRelation()->getMemberships());
|
2018-10-29 19:01:00 +01:00
|
|
|
$this->assertInstanceOf(LawInterface::class, $this->source->getLaw());
|
2018-11-25 23:12:42 +01:00
|
|
|
$this->assertEquals($this->source, $this->source->getLaw()->getSource());
|
2018-11-26 22:36:08 +01:00
|
|
|
$this->assertInstanceOf(Collection::class, $this->source->getMemberRelation()->getMembers());
|
2018-10-28 20:28:29 +01:00
|
|
|
}
|
2018-11-23 18:17:00 +01:00
|
|
|
|
|
|
|
public function testSlugInit(): void
|
|
|
|
{
|
2019-02-13 18:03:25 +01:00
|
|
|
$this->assertNull($this->source->getSlug());
|
2018-11-23 18:17:00 +01:00
|
|
|
}
|
2018-11-01 22:34:26 +01:00
|
|
|
}
|