public function testAddCatalogToTopMenuItemsWithFlat()
 {
     $observer = $this->_preparationData();
     $this->_category->expects($this->once())->method('getChildrenNodes')->will($this->returnValue([$this->_childrenCategory]));
     $this->_category->expects($this->once())->method('getUseFlatResource')->will($this->returnValue(true));
     $this->_categoryFlatState->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
     $this->_observer->addCatalogToTopmenuItems($observer);
 }
Example #2
0
 public function testGetMenuCategoryData()
 {
     $category = $this->getMock('Magento\\Catalog\\Model\\Category', ['getId', 'getName'], [], '', false);
     $category->expects($this->once())->method('getId')->willReturn('id');
     $category->expects($this->once())->method('getName')->willReturn('name');
     $this->_catalogCategory->expects($this->once())->method('getCategoryUrl')->willReturn('url');
     $this->assertEquals(['name' => 'name', 'id' => 'category-node-id', 'url' => 'url', 'is_active' => false, 'has_active' => false], $this->_observer->getMenuCategoryData($category));
 }