public function testGetCategoryList()
 {
     $tree = ['id' => 1, 'parent' => '#', 'text' => 'Master catalog', 'state' => ['opened' => true]];
     $this->categoryTreeHandler->expects($this->once())->method('createTree')->will($this->returnValue($tree));
     $result = $this->extension->getCategoryList();
     $this->assertEquals($tree, $result);
 }
 public function testGetCategoryListWithRootLabel()
 {
     $tree = [['id' => 1, 'parent' => '#', 'text' => '[trans]orob2b.catalog.frontend.category.master_category.label[/trans]', 'state' => ['opened' => true]]];
     $this->categoryTreeHandler->expects($this->once())->method('createTree')->will($this->returnValue($tree));
     $result = $this->extension->getCategoryList('orob2b.catalog.frontend.category.master_category.label');
     $this->assertEquals($tree, $result);
 }
 /**
  * @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();
 }