mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Solved infinite recursion bug
This commit is contained in:
parent
0d0fa68094
commit
9137c55b17
@ -105,7 +105,7 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
|||||||
{
|
{
|
||||||
$leaves = new ArrayCollection($this->getLeaves()->toArray());
|
$leaves = new ArrayCollection($this->getLeaves()->toArray());
|
||||||
foreach ($this->getAllBranches() as $branch) {
|
foreach ($this->getAllBranches() as $branch) {
|
||||||
foreach ((new self($branch))->getAllLeaves() as $leave) {
|
foreach ((new self($branch))->getLeaves() as $leave) {
|
||||||
if (! $leaves->contains($leave)) {
|
if (! $leaves->contains($leave)) {
|
||||||
$leaves->add($leave);
|
$leaves->add($leave);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class TreeSourceServiceTest extends TestCase
|
|||||||
$leave4 = $this->createMock(SourceInterface::class);
|
$leave4 = $this->createMock(SourceInterface::class);
|
||||||
$leave5 = $this->createMock(SourceInterface::class);
|
$leave5 = $this->createMock(SourceInterface::class);
|
||||||
$tree2->setCollection(new ArrayCollection([$leave3,$leave4,$tree5,$leave5]));
|
$tree2->setCollection(new ArrayCollection([$leave3,$leave4,$tree5,$leave5]));
|
||||||
$collection = new ArrayCollection([$tree2,$tree3,$leave1,$leave2,$tree4]);
|
$collection = new ArrayCollection([$tree2,$tree3,$leave1,$leave2,$tree4,$tree1]);
|
||||||
$tree1->setCollection($collection);
|
$tree1->setCollection($collection);
|
||||||
$this->treeService = new TreeSourceService($tree1);
|
$this->treeService = new TreeSourceService($tree1);
|
||||||
}
|
}
|
||||||
@ -39,11 +39,11 @@ class TreeSourceServiceTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testGetBranches():void{
|
public function testGetBranches():void{
|
||||||
$this->assertEquals(3, $this->treeService->getBranches()->count());
|
$this->assertEquals(4, $this->treeService->getBranches()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAllBranches():void{
|
public function testGetAllBranches():void{
|
||||||
$this->assertEquals(4, $this->treeService->getAllBranches()->count());
|
$this->assertEquals(5, $this->treeService->getAllBranches()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAllLeaves():void{
|
public function testGetAllLeaves():void{
|
||||||
|
Loading…
Reference in New Issue
Block a user