/**
  * {@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);
     }
 }
Exemple #2
0
 public function testSaveActionThrowsException()
 {
     $this->requestMock->expects($this->any())->method('getPostValue')->willReturn(['block_id' => 1]);
     $this->requestMock->expects($this->atLeastOnce())->method('getParam')->willReturnMap([['block_id', null, 1], ['back', null, true]]);
     $this->objectManagerMock->expects($this->atLeastOnce())->method('create')->with($this->equalTo('Magento\\Cms\\Model\\Block'))->willReturn($this->blockMock);
     $this->blockMock->expects($this->any())->method('load')->willReturnSelf();
     $this->blockMock->expects($this->any())->method('getId')->willReturn(true);
     $this->blockMock->expects($this->once())->method('setData');
     $this->blockMock->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_block', ['block_id' => 1]);
     $this->resultRedirect->expects($this->atLeastOnce())->method('setPath')->with('*/*/edit', ['block_id' => $this->blockId])->willReturnSelf();
     $this->assertSame($this->resultRedirect, $this->saveController->execute());
 }
Exemple #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);
     }
 }