Exemplo n.º 1
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);
     }
 }
 public function testExecuteInvalidArgument()
 {
     $themeId = 1;
     $refererUrl = 'referer/url';
     $this->request->expects($this->any())->method('getParam')->with('theme_id')->willReturn($themeId);
     $themeFactory = $this->getMockBuilder('Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
     $this->objectManager->expects($this->any())->method('get')->with('Psr\\Log\\LoggerInterface')->willReturn($logger);
     $this->objectManager->expects($this->any())->method('create')->with('Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory')->willReturn($themeFactory);
     $themeFactory->expects($this->once())->method('create')->with($themeId)->willReturn(null);
     $this->messageManager->expects($this->once())->method('addException');
     $logger->expects($this->once())->method('critical');
     $this->redirect->expects($this->once())->method('getRefererUrl')->willReturn($refererUrl);
     $this->response->expects($this->once())->method('setRedirect')->with($refererUrl);
     $this->controller->execute();
 }