2018-11-01 20:42:18 +01:00
|
|
|
<?php
|
2018-11-01 22:34:26 +01:00
|
|
|
|
2019-01-20 10:41:58 +01:00
|
|
|
namespace Tests\Unit\Attribut;
|
2018-11-01 20:42:18 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Attribut\MembershipsAttributInterface;
|
|
|
|
use Infinito\Attribut\MembershipsAttribut;
|
2018-11-01 20:42:18 +01:00
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Source\Complex\Collection\TreeCollectionSourceInterface;
|
2018-11-01 20:42:18 +01:00
|
|
|
|
|
|
|
class MembershipsAttributTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var MembershipsAttributInterface
|
|
|
|
*/
|
|
|
|
protected $memberships;
|
2018-11-01 22:34:26 +01:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->memberships = new class() implements MembershipsAttributInterface {
|
2018-11-01 20:42:18 +01:00
|
|
|
use MembershipsAttribut;
|
|
|
|
};
|
|
|
|
}
|
2018-11-01 22:34:26 +01:00
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2018-11-01 20:42:18 +01:00
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->memberships->getMemberships();
|
|
|
|
}
|
2018-11-01 22:34:26 +01:00
|
|
|
|
|
|
|
public function testAccessors(): void
|
|
|
|
{
|
2018-11-02 21:38:04 +01:00
|
|
|
$membership = $this->createMock(TreeCollectionSourceInterface::class);
|
2018-11-01 20:42:18 +01:00
|
|
|
$this->assertNull($this->memberships->setMemberships(new ArrayCollection([$membership])));
|
|
|
|
$this->assertEquals($this->memberships->getMemberships()->get(0), $membership);
|
|
|
|
}
|
|
|
|
}
|