/** * @param string|null $rootLabel * @return array */ public function getCategoryList($rootLabel = null) { $tree = $this->categoryTreeHandler->createTree(); if ($rootLabel && array_key_exists(0, $tree)) { $tree[0]['text'] = $this->translator->trans($rootLabel); } return $tree; }
/** * @dataProvider createTreeDataProvider * @param Category[] $categories * @param array $expected */ public function testCreateTree($categories, array $expected) { $this->managerRegistry->expects($this->any())->method('getRepository')->with('OroB2BCatalogBundle:Category')->willReturn($this->repository); $this->repository->expects($this->any())->method('getChildrenWithTitles')->with(null, false, 'left', 'ASC')->willReturn($categories); $result = $this->categoryTreeHandler->createTree(); $this->assertEquals($expected, $result); }
/** * @return array */ public function getCategoryList() { return $this->categoryTreeHandler->createTree(); }