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

43 lines
1.0 KiB
PHP
Raw Normal View History

2018-11-01 19:59:36 +01:00
<?php
2018-11-01 22:34:26 +01:00
2018-11-01 19:59:36 +01:00
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;
use App\Entity\Source\Collection\MemberCollectionSourceInterface;
use App\Entity\Source\Collection\MemberCollectionSource;
/**
* @author kevinfrantz
*/
class MemberCollectionSourceTest extends TestCase
{
/**
* @var MemberCollectionSourceInterface
*/
protected $groupSource;
public function setUp(): void
{
$this->groupSource = new MemberCollectionSource();
}
public function testConstructor(): void
{
$this->assertInstanceOf(Collection::class, $this->groupSource->getMembers());
}
public function testMembers()
{
2018-11-01 22:34:26 +01:00
$member = new class() extends AbstractSource {
};
2018-11-01 19:59:36 +01:00
$this->groupSource->setMembers(new ArrayCollection([
2018-11-01 22:34:26 +01:00
$member,
2018-11-01 19:59:36 +01:00
]));
$this->assertEquals($member, $this->groupSource->getMembers()
->get(0));
}
}