Solved tests for SourceMembershipInformation pass

This commit is contained in:
Kevin Frantz 2018-11-26 22:08:32 +01:00
parent b183af90e6
commit 67ef76b308
2 changed files with 8 additions and 8 deletions

View File

@ -28,7 +28,7 @@ class SourceMembershipInformation implements SourceMembershipInformationInterfac
foreach ($memberships as $membership) {
if (!$this->memberships->contains($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
{
$this->memberships = new ArrayCollection();
$this->itterateOverMemberships($this->source->getMemberships());
$this->itterateOverMemberships($this->source->getMemberRelation()->getMemberships());
return $this->memberships;
}

View File

@ -32,7 +32,7 @@ class SourceMembershipInformationTest extends TestCase
public function testOneDimension(): void
{
$this->source->getMemberships()->add(new TextSource());
$this->source->getMemberRelation()->getMemberships()->add(new TextSource());
$this->assertEquals(1, $this->sourceMembershipInformation->getAllMemberships()->count());
}
@ -40,18 +40,18 @@ class SourceMembershipInformationTest extends TestCase
{
$source1 = new TextSource();
$source2 = new FirstNameSource();
$source2->setMemberships(new ArrayCollection([$source1]));
$source2->getMemberRelation()->setMemberships(new ArrayCollection([$source1]));
$source3 = new FullPersonNameSource();
$source3->getMemberships()->add($source2);
$this->source->getMemberships()->add($source3);
$source3->getMemberRelation()->getMemberships()->add($source2);
$this->source->getMemberRelation()->getMemberships()->add($source3);
$this->assertEquals(3, $this->sourceMembershipInformation->getAllMemberships()->count());
}
public function testRecursion(): void
{
$recursiveSource = new UserSource();
$recursiveSource->getMemberships()->add($this->source);
$this->source->getMemberships()->add($recursiveSource);
$recursiveSource->getMemberRelation()->getMemberships()->add($this->source);
$this->source->getMemberRelation()->getMemberships()->add($recursiveSource);
$this->assertEquals(2, $this->sourceMembershipInformation->getAllMemberships()->count());
}
}