public function testExecute() { $cleanupFilesMock = $this->getMockBuilder('Magento\\Framework\\App\\State\\CleanupFiles')->disableOriginalConstructor()->getMock(); $cleanupFilesMock->expects($this->once())->method('clearMaterializedViewFiles'); $this->objectManagerMock->expects($this->once())->method('get')->will($this->returnValue($cleanupFilesMock)); $this->eventManagerMock->expects($this->once())->method('dispatch')->with('clean_static_files_cache_after'); $this->messageManagerMock->expects($this->once())->method('addSuccess')->with('The static files cache has been cleaned.'); $resultRedirect = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock(); $this->resultFactoryMock->expects($this->atLeastOnce())->method('create')->with(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT)->willReturn($resultRedirect); $resultRedirect->expects($this->once())->method('setPath')->with('adminhtml/*')->willReturnSelf(); // Run $this->controller->execute(); }
/** * {@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); } }
/** * {@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); } }