Example #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);
     }
 }
Example #2
0
 public function testDeleteActionThrowsException()
 {
     $errorMsg = 'Can\'t create the block';
     $this->requestMock->expects($this->once())->method('getParam')->willReturn($this->blockId);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Cms\\Model\\Block')->willThrowException(new \Exception(__($errorMsg)));
     $this->messageManagerMock->expects($this->once())->method('addError')->with($errorMsg);
     $this->messageManagerMock->expects($this->never())->method('addSuccess');
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('*/*/edit', ['block_id' => $this->blockId])->willReturnSelf();
     $this->assertSame($this->resultRedirectMock, $this->deleteController->execute());
 }