public function testRunWithException2() { $this->shell->setRawArgs(['data', '--config', 'file/to/config.xml']); $this->logManager->expects($this->once())->method('process'); $mode = $this->getMock('\\Migration\\Mode\\Data', [], [], '', false); $mode->expects($this->any())->method('run')->willThrowException(new \Migration\Exception('test error message')); $this->modeFactory->expects($this->once())->method('create')->with('data')->willReturn($mode); $this->logger->expects($this->once())->method('error')->with($this->stringContains('test error message')); $this->shell->run(); }