2018-11-24 18:13:04 +01:00
|
|
|
<?php
|
|
|
|
|
2019-01-20 10:41:58 +01:00
|
|
|
namespace Tests\Unit\Attribut;
|
2018-11-24 18:13:04 +01:00
|
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Attribut\MembersAttribut;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Attribut\MembersAttributInterface;
|
|
|
|
use Infinito\Entity\Source\SourceInterface;
|
2020-04-02 21:13:35 +02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-11-24 18:13:04 +01:00
|
|
|
|
|
|
|
class MembersAttributTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var MembersAttributInterface
|
|
|
|
*/
|
|
|
|
protected $members;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->members = new class() implements MembersAttributInterface {
|
|
|
|
use MembersAttribut;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->members->getMembers();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testAccessors(): void
|
|
|
|
{
|
|
|
|
$membership = $this->createMock(SourceInterface::class);
|
|
|
|
$this->assertNull($this->members->setMembers(new ArrayCollection([$membership])));
|
|
|
|
$this->assertEquals($this->members->getMembers()->get(0), $membership);
|
|
|
|
}
|
|
|
|
}
|