public function testExecute() { $this->_response->expects($this->once())->method('setCode')->with(0); $this->_response->expects($this->once())->method('getCode')->will($this->returnValue(0)); $dir = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\Write', [], [], '', false); $dir->expects($this->any())->method('getRelativePath')->will($this->returnArgument(0)); $this->filesystem->expects($this->once())->method('getDirectoryWrite')->will($this->returnValue($dir)); $this->processor->expects($this->once())->method('reindexAll'); $this->assertEquals(0, $this->entryPoint->launch()->getCode()); }
public function testLaunchDispatchesCronEvent() { $configLoader = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface'); $eventManagerMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface'); $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Framework\\ObjectManager\\ConfigLoaderInterface', $configLoader], ['Magento\\Framework\\Event\\ManagerInterface', $eventManagerMock]])); $crontabConfig = ['config']; $configLoader->expects($this->once())->method('load')->with(Area::AREA_CRONTAB)->willReturn($crontabConfig); $this->objectManager->expects($this->once())->method('configure')->with($crontabConfig); $this->_stateMock->expects($this->once())->method('setAreaCode')->with(Area::AREA_CRONTAB); $eventManagerMock->expects($this->once())->method('dispatch')->with('default'); $this->_responseMock->expects($this->once())->method('setCode')->with(0); $this->assertEquals($this->_responseMock, $this->_model->launch()); }
public function testCatchException() { $exceptionMessage = 'Exception message'; $model = new ManagerApp($this->cacheManager, $this->response, []); $this->response->expects($this->once())->method('setBody')->with($exceptionMessage); $this->assertFalse($model->catchException($this->getMock('Magento\\Framework\\App\\Bootstrap', [], [], '', false), new \Exception($exceptionMessage))); }