2018-11-02 21:38:04 +01:00
|
|
|
<?php
|
|
|
|
|
2018-11-22 21:57:24 +01:00
|
|
|
namespace Tests\Unit\Entity\Source\Complex\Collection;
|
2018-11-02 21:38:04 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Source\Complex\Collection\TreeCollectionSourceInterface;
|
|
|
|
use Infinito\Entity\Source\Complex\Collection\TreeCollectionSource;
|
|
|
|
use Infinito\Entity\Source\PureSource;
|
2018-11-02 21:38:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class TreeCollectionSourceTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var TreeCollectionSourceInterface
|
|
|
|
*/
|
|
|
|
protected $tree;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->tree = new TreeCollectionSource();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2018-11-04 23:47:43 +01:00
|
|
|
$this->assertInstanceOf(Collection::class, $this->tree->getCollection());
|
2018-11-02 21:38:04 +01:00
|
|
|
$this->assertInstanceOf(TreeCollectionSourceInterface::class, $this->tree);
|
|
|
|
}
|
|
|
|
|
2018-11-04 23:47:43 +01:00
|
|
|
public function testAccessors()
|
2018-11-02 21:38:04 +01:00
|
|
|
{
|
2019-01-04 22:09:05 +01:00
|
|
|
$member = new PureSource();
|
2018-11-04 23:47:43 +01:00
|
|
|
$this->tree->setCollection(new ArrayCollection([
|
2018-11-02 21:38:04 +01:00
|
|
|
$member,
|
|
|
|
]));
|
2018-11-04 23:47:43 +01:00
|
|
|
$this->assertEquals($member, $this->tree->getCollection()
|
2018-11-02 21:38:04 +01:00
|
|
|
->get(0));
|
|
|
|
}
|
|
|
|
}
|