mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Solved tests for SourceMembershipInformation pass
This commit is contained in:
parent
b183af90e6
commit
67ef76b308
@ -28,7 +28,7 @@ class SourceMembershipInformation implements SourceMembershipInformationInterfac
|
|||||||
foreach ($memberships as $membership) {
|
foreach ($memberships as $membership) {
|
||||||
if (!$this->memberships->contains($membership)) {
|
if (!$this->memberships->contains($membership)) {
|
||||||
$this->memberships->add($membership);
|
$this->memberships->add($membership);
|
||||||
$this->itterateOverMemberships($membership->getMemberships());
|
$this->itterateOverMemberships($membership->getMemberRelation()->getMemberships());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ class SourceMembershipInformation implements SourceMembershipInformationInterfac
|
|||||||
public function getAllMemberships(): Collection
|
public function getAllMemberships(): Collection
|
||||||
{
|
{
|
||||||
$this->memberships = new ArrayCollection();
|
$this->memberships = new ArrayCollection();
|
||||||
$this->itterateOverMemberships($this->source->getMemberships());
|
$this->itterateOverMemberships($this->source->getMemberRelation()->getMemberships());
|
||||||
|
|
||||||
return $this->memberships;
|
return $this->memberships;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class SourceMembershipInformationTest extends TestCase
|
|||||||
|
|
||||||
public function testOneDimension(): void
|
public function testOneDimension(): void
|
||||||
{
|
{
|
||||||
$this->source->getMemberships()->add(new TextSource());
|
$this->source->getMemberRelation()->getMemberships()->add(new TextSource());
|
||||||
$this->assertEquals(1, $this->sourceMembershipInformation->getAllMemberships()->count());
|
$this->assertEquals(1, $this->sourceMembershipInformation->getAllMemberships()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,18 +40,18 @@ class SourceMembershipInformationTest extends TestCase
|
|||||||
{
|
{
|
||||||
$source1 = new TextSource();
|
$source1 = new TextSource();
|
||||||
$source2 = new FirstNameSource();
|
$source2 = new FirstNameSource();
|
||||||
$source2->setMemberships(new ArrayCollection([$source1]));
|
$source2->getMemberRelation()->setMemberships(new ArrayCollection([$source1]));
|
||||||
$source3 = new FullPersonNameSource();
|
$source3 = new FullPersonNameSource();
|
||||||
$source3->getMemberships()->add($source2);
|
$source3->getMemberRelation()->getMemberships()->add($source2);
|
||||||
$this->source->getMemberships()->add($source3);
|
$this->source->getMemberRelation()->getMemberships()->add($source3);
|
||||||
$this->assertEquals(3, $this->sourceMembershipInformation->getAllMemberships()->count());
|
$this->assertEquals(3, $this->sourceMembershipInformation->getAllMemberships()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRecursion(): void
|
public function testRecursion(): void
|
||||||
{
|
{
|
||||||
$recursiveSource = new UserSource();
|
$recursiveSource = new UserSource();
|
||||||
$recursiveSource->getMemberships()->add($this->source);
|
$recursiveSource->getMemberRelation()->getMemberships()->add($this->source);
|
||||||
$this->source->getMemberships()->add($recursiveSource);
|
$this->source->getMemberRelation()->getMemberships()->add($recursiveSource);
|
||||||
$this->assertEquals(2, $this->sourceMembershipInformation->getAllMemberships()->count());
|
$this->assertEquals(2, $this->sourceMembershipInformation->getAllMemberships()->count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user