Refactored method name

This commit is contained in:
Kevin Frantz 2018-10-31 20:47:51 +01:00
parent e7b41dab22
commit 48697c8b12
4 changed files with 9 additions and 9 deletions

View File

@ -31,7 +31,7 @@ trait MembersAttribut
*
* @return Collection|MembersAttributInterface[] Returns all members till the defined dimension
*/
public function getMembersInclusiveChildren(?int $dimension = null, Collection $members = null): Collection
public function getMembersIncludingChildren(?int $dimension = null, Collection $members = null): Collection
{
$dimension = is_int($dimension) ? $dimension - 1 : null;
$members = $members ?? new ArrayCollection();
@ -39,7 +39,7 @@ trait MembersAttribut
if (!$members->contains($member)) {
$members->add($member);
if ($this->continueIncludeMembersLoop($dimension) && $member instanceof MembersAttributInterface) {
$member->getMembersInclusiveChildren($dimension, $members);
$member->getMembersIncludingChildren($dimension, $members);
}
}
}

View File

@ -24,5 +24,5 @@ interface MembersAttributInterface
/**
* @return Collection
*/
public function getMembersInclusiveChildren(int $dimension = null): Collection;
public function getMembersIncludingChildren(int $dimension = null): Collection;
}

View File

@ -27,7 +27,7 @@ class MembersAttributTest extends AbstractTestCase
{
$this->expectException(\TypeError::class);
$this->membersAttribut->getMembers();
$this->membersAttribut->getMembersInclusiveChildren();
$this->membersAttribut->getMembersIncludingChildren();
}
private function getContinueIncludeMemberLoopResult($dimension): bool
@ -69,7 +69,7 @@ class MembersAttributTest extends AbstractTestCase
$source3->setMembers(new ArrayCollection([$source4]));
$members = new ArrayCollection([$source1, $source2, $source3]);
$this->assertNull($this->membersAttribut->setMembers($members));
$this->assertEquals(3, $this->membersAttribut->getMembersInclusiveChildren(1)->count());
$this->assertEquals(3, $this->membersAttribut->getMembersIncludingChildren(1)->count());
}
public function test3DimensionsMembersInclusiveChildren(): void
@ -87,7 +87,7 @@ class MembersAttributTest extends AbstractTestCase
$this->assertEquals(1, $source2->getMembers()->count());
$this->assertEquals(1, $source3->getMembers()->count());
$this->assertEquals(0, $source4->getMembers()->count());
$this->assertEquals(3, $this->membersAttribut->getMembersInclusiveChildren(3)->count());
$this->assertEquals(3, $this->membersAttribut->getMembersIncludingChildren(3)->count());
}
public function testMembersIncludingChildrenInfinite(): void
@ -105,7 +105,7 @@ class MembersAttributTest extends AbstractTestCase
$source5->setMembers(new ArrayCollection([$source6]));
$this->membersAttribut->setMembers(new ArrayCollection([$source1]));
$this->assertEquals(6, $this->membersAttribut->getMembersInclusiveChildren()->count());
$this->assertEquals(6, $this->membersAttribut->getMembersIncludingChildren()->count());
}
public function testMemberWithoutMembers(): void
@ -113,6 +113,6 @@ class MembersAttributTest extends AbstractTestCase
$source1 = new class() extends AbstractSource {
};
$this->membersAttribut->setMembers(new ArrayCollection([$source1]));
$this->assertEquals(1, $this->membersAttribut->getMembersInclusiveChildren()->count());
$this->assertEquals(1, $this->membersAttribut->getMembersIncludingChildren()->count());
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\tests\unit\Entity\Meta;
namespace App\Tests\Unit\Entity\Meta;
use PHPUnit\Framework\TestCase;
use Doctrine\Common\Collections\Collection;