Ejemplo 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 testSaveActionThrowsException()
 {
     $this->requestMock->expects($this->any())->method('getPostValue')->willReturn(['page_id' => $this->pageId]);
     $this->requestMock->expects($this->atLeastOnce())->method('getParam')->willReturnMap([['page_id', null, $this->pageId], ['back', null, true]]);
     $this->dataProcessorMock->expects($this->any())->method('filter')->willReturnArgument(0);
     $this->objectManagerMock->expects($this->atLeastOnce())->method('create')->with($this->equalTo('Magento\\Cms\\Model\\Page'))->willReturn($this->pageMock);
     $this->pageMock->expects($this->any())->method('load')->willReturnSelf();
     $this->pageMock->expects($this->any())->method('getId')->willReturn(true);
     $this->pageMock->expects($this->once())->method('setData');
     $this->pageMock->expects($this->once())->method('save')->willThrowException(new \Exception('Error message.'));
     $this->messageManagerMock->expects($this->never())->method('addSuccess');
     $this->messageManagerMock->expects($this->once())->method('addException');
     $this->dataPersistorMock->expects($this->any())->method('set')->with('cms_page', ['page_id' => $this->pageId]);
     $this->resultRedirect->expects($this->atLeastOnce())->method('setPath')->with('*/*/edit', ['page_id' => $this->pageId])->willReturnSelf();
     $this->assertSame($this->resultRedirect, $this->saveController->execute());
 }
Ejemplo n.º 3
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);
     }
 }