public function testGetChildrenCreatesSubmenuOnFirstCall() { $menuMock = $this->getMock('Magento\\Backend\\Model\\Menu', [], [$this->getMock('Psr\\Log\\LoggerInterface')]); $this->_menuFactoryMock->expects($this->once())->method('create')->will($this->returnValue($menuMock)); $this->_model->getChildren(); $this->_model->getChildren(); }
/** * Add sub menu HTML code for current menu item * * @param \Magento\Backend\Model\Menu\Item $menuItem * @param int $level * @param int $limit * @param $id int * @return string HTML code */ protected function _addSubMenu($menuItem, $level, $limit, $id = null) { $output = ''; if (!$menuItem->hasChildren()) { return $output; } $output .= '<div class="submenu"' . ($level == 0 && isset($id) ? ' aria-labelledby="' . $id . '"' : '') . '>'; $colStops = null; if ($level == 0 && $limit) { $colStops = $this->_columnBrake($menuItem->getChildren(), $limit); $output .= '<strong class="submenu-title">' . $this->_getAnchorLabel($menuItem) . '</strong>'; $output .= '<a href="#" class="action-close _close" data-role="close-submenu"></a>'; } $output .= $this->renderNavigation($menuItem->getChildren(), $level + 1, $limit, $colStops); $output .= '</div>'; return $output; }
/** * Add sub menu HTML code for current menu item * * @param \Magento\Backend\Model\Menu\Item $menuItem * @param int $level * @param int $limit * @return string HTML code */ protected function _addSubMenu($menuItem, $level, $limit) { $output = ''; if (!$menuItem->hasChildren()) { return $output; } $output .= '<div class="submenu">'; $colStops = null; if ($level == 0 && $limit) { $colStops = $this->_columnBrake($menuItem->getChildren(), $limit); } $output .= $this->renderNavigation($menuItem->getChildren(), $level + 1, $limit, $colStops); $output .= '</div>'; return $output; }