コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getResponse()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getResponse');
     if (!$pluginInfo) {
         return parent::getResponse();
     } else {
         return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo);
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 /**
  * 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);
 }