mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Optimized draft for MemberRelation
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Entity\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attribut\MemberRelationAttributInterface;
|
||||
use App\Entity\Attribut\MemberRelationAttribut;
|
||||
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||
|
||||
class MemberRelationAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MemberRelationAttributInterface
|
||||
*/
|
||||
protected $memberRelation;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->memberRelation = new class() implements MemberRelationAttributInterface {
|
||||
use MemberRelationAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->memberRelation->getMemberRelation();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$membership = $this->createMock(MemberRelationInterface::class);
|
||||
$this->assertNull($this->memberRelation->setMemberRelation(new ArrayCollection([$membership])));
|
||||
$this->assertEquals($this->memberRelation->getMemberRelation()->get(0), $membership);
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Entity\Meta\Relation\Member;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Meta\Relation\Member\MemberRelation;
|
||||
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
class MemberRelationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MemberRelationInterface
|
||||
*/
|
||||
private $memberRelation;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->memberRelation = new MemberRelation();
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertInstanceOf(Collection::class, $this->memberRelation->getMembers());
|
||||
$this->assertInstanceOf(Collection::class, $this->memberRelation->getMembership());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user