infinito/application/tests/Unit/Entity/Meta/Relation/Parent/AbstractParentRelationTest.php

31 lines
862 B
PHP
Raw Normal View History

2018-11-04 13:05:35 +01:00
<?php
2018-11-04 13:05:35 +01:00
namespace tests\Unit\Entity\Meta;
use PHPUnit\Framework\TestCase;
use Doctrine\Common\Collections\Collection;
2018-11-25 23:46:13 +01:00
use App\Entity\Meta\Relation\Parent\AbstractParentRelation;
use App\Entity\Meta\Relation\Parent\ParentRelationInterface;
2018-11-04 13:05:35 +01:00
2018-11-25 23:46:13 +01:00
class AbstractParentRelationTest extends TestCase
2018-11-04 13:05:35 +01:00
{
/**
2018-11-25 23:46:13 +01:00
* @var ParentRelationInterface
2018-11-04 13:05:35 +01:00
*/
protected $relation;
public function setUp(): void
{
2018-11-25 23:46:13 +01:00
$this->relation = new class extends AbstractParentRelation{};
2018-11-04 13:05:35 +01:00
}
public function testConstructor(): void
{
2018-11-04 13:05:35 +01:00
$this->assertInstanceOf(Collection::class, $this->relation->getChilds());
$this->assertInstanceOf(Collection::class, $this->relation->getParents());
$this->assertEquals(0, $this->relation->getVersion());
2018-11-04 13:05:35 +01:00
$this->expectException(\TypeError::class);
$this->relation->getSource();
}
}