infinito/application/tests/Unit/Entity/Source/Collection/TreeCollectionSourceTest.php

44 lines
1.1 KiB
PHP
Raw Normal View History

2018-11-02 21:38:04 +01:00
<?php
namespace Tests\Unit\Entity\Source\Collection;
use PHPUnit\Framework\TestCase;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Source\AbstractSource;
2018-11-22 20:50:05 +01:00
use App\Entity\Source\Complex\Collection\TreeCollectionSourceInterface;
use App\Entity\Source\Complex\Collection\TreeCollectionSource;
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
{
$member = new class() extends AbstractSource {
};
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));
}
}