示例#1
0
 /**
  * Initialize design
  *
  * @param \Magento\Framework\App\ActionInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return mixed
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundExecute(
     \Magento\Framework\App\ActionInterface $subject,
     \Closure $proceed,
     \Magento\Framework\App\RequestInterface $request
 ) {
     $this->_designLoader->load();
     return $proceed($request);
 }
 public function testLoad()
 {
     $area = $this->getMock('Magento\\Framework\\App\\Area', [], [], '', false);
     $this->appState->expects($this->once())->method('getAreaCode')->will($this->returnValue('area'));
     $this->_areaListMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area));
     $area->expects($this->at(0))->method('load')->with(\Magento\Framework\App\Area::PART_DESIGN)->will($this->returnValue($area));
     $area->expects($this->at(1))->method('load')->with(\Magento\Framework\App\Area::PART_TRANSLATE)->will($this->returnValue($area));
     $this->_model->load($this->_requestMock);
 }
示例#3
0
 /**
  * Initialize design
  *
  * @param \Magento\Framework\App\ActionInterface $subject
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function beforeDispatch(\Magento\Framework\App\ActionInterface $subject, \Magento\Framework\App\RequestInterface $request)
 {
     try {
         $this->_designLoader->load();
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         if ($e->getPrevious() instanceof \Magento\Framework\Config\Dom\ValidationException) {
             /** @var MessageInterface $message */
             $message = $this->messageManager->createMessage(MessageInterface::TYPE_ERROR)->setText($e->getMessage());
             $this->messageManager->addUniqueMessages([$message]);
         }
     }
 }
示例#4
0
 /**
  * Initialize design
  *
  * @param \Magento\Framework\App\ActionInterface $subject
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return mixed
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function beforeDispatch(\Magento\Framework\App\ActionInterface $subject, \Magento\Framework\App\RequestInterface $request)
 {
     $this->_designLoader->load();
 }