diff --git a/application/src/Domain/SourceManagement/TreeSourceService.php b/application/src/Domain/SourceManagement/TreeSourceService.php index 77b0e7a..c207170 100644 --- a/application/src/Domain/SourceManagement/TreeSourceService.php +++ b/application/src/Domain/SourceManagement/TreeSourceService.php @@ -41,6 +41,7 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc $this->source = $source; $this->branches = new ArrayCollection(); $this->leaves = new ArrayCollection(); + $this->basicSort(); } private function sortMember(SourceInterface $member): bool diff --git a/application/tests/Unit/Domain/TreeSourceServiceTest.php b/application/tests/Unit/Domain/TreeSourceServiceTest.php new file mode 100644 index 0000000..1638f33 --- /dev/null +++ b/application/tests/Unit/Domain/TreeSourceServiceTest.php @@ -0,0 +1,35 @@ +createMock(SourceInterface::class); + $leave2 = $this->createMock(SourceInterface::class); + $collection = new ArrayCollection([$tree2,$tree3,$leave1,$leave2]); + $tree1->setCollection($collection); + $this->treeService = new TreeSourceService($tree1); + } + + public function testGetLeaves():void{ + $this->assertEquals(2, $this->treeService->getLeaves()->count()); + } +} +