/** * {@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); } }
/** * @covers \Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive::execute */ public function testExecuteException() { $exception = new \Exception('epic fail'); $placeholderPath = 'pub/static/adminhtml/Magento/backend/en_US/Magento_Cms/images/wysiwyg_skin_image.png'; $mimeType = 'image/png'; $imageBody = '0123456789abcdefghijklmnopqrstuvwxyz'; $this->prepareExecuteTest(); $this->imageAdapterMock->expects($this->at(0))->method('open')->with(self::IMAGE_PATH)->willThrowException($exception); $this->wysiwygConfigMock->expects($this->once())->method('getSkinImagePlaceholderPath')->willReturn($placeholderPath); $this->imageAdapterMock->expects($this->at(1))->method('open')->with($placeholderPath); $this->imageAdapterMock->expects($this->once())->method('getMimeType')->willReturn($mimeType); $this->responseMock->expects($this->once())->method('setHeader')->with('Content-Type', $mimeType)->willReturnSelf(); $this->imageAdapterMock->expects($this->once())->method('getImage')->willReturn($imageBody); $this->responseMock->expects($this->once())->method('setBody')->with($imageBody)->willReturnSelf(); $this->loggerMock->expects($this->once())->method('critical')->with($exception); $this->wysiwygDirective->execute(); }
/** * {@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); } }