/** * {@inheritdoc} */ public function execute() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'execute'); if (!$pluginInfo) { return parent::execute(); } else { return $this->___callPlugins('execute', func_get_args(), $pluginInfo); } }
public function testApplyCustomLayoutUpdate() { $categoryId = 123; $pageLayout = 'page_layout'; $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Catalog\\Helper\\Category', $this->categoryHelper], ['Magento\\Theme\\Helper\\Layout', $this->layoutHelper]])); $this->request->expects($this->any())->method('getParam')->will($this->returnValueMap([[Action::PARAM_NAME_URL_ENCODED], ['id', false, $categoryId]])); $this->categoryRepository->expects($this->any())->method('get')->with($categoryId)->will($this->returnValue($this->category)); $this->categoryHelper->expects($this->any())->method('canShow')->will($this->returnValue(true)); $settings = $this->getMock('Magento\\Framework\\Object', ['getPageLayout'], [], '', false); $settings->expects($this->atLeastOnce())->method('getPageLayout')->will($this->returnValue($pageLayout)); $this->catalogDesign->expects($this->any())->method('getDesignSettings')->will($this->returnValue($settings)); $this->action->execute(); }
/** * Category view action * * @param \Magento\Catalog\Controller\Category\View $coreRoute * @return \Magento\Framework\Controller\ResultInterface */ public function execute($coreRoute = null) { $categoryId = (int) $this->getRequest()->getParam('id', false); if (!$categoryId) { return $this->_forward('index', 'categorynoroute', 'custom404Page'); } try { $category = $this->categoryRepository->get($categoryId, $this->_storeManager->getStore()->getId()); } catch (NoSuchEntityException $e) { return $this->_forward('index', 'categorynoroute', 'custom404Page'); } if (!$this->_objectManager->get('Magento\\Catalog\\Helper\\Category')->canShow($category)) { return $this->_forward('index', 'categorynoroute', 'custom404Page'); } return parent::execute($coreRoute); }