Exemplo n.º 1
0
 public function testLaunchWithException()
 {
     $writer = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\WriteInterface');
     $writer->expects($this->any())->method('isDirectory')->will($this->returnValue(false));
     $writer->expects($this->any())->method('create')->will($this->returnValue(true));
     $this->writeFactory->expects($this->any())->method('create')->will($this->returnValue($writer));
     $shell = $this->getMock('\\Migration\\App\\Shell', ['run'], [], '', false);
     $shell->expects($this->any())->method('run')->willThrowException(new \Exception('error'));
     $this->shellFactory->expects($this->any())->method('create')->will($this->returnValue($shell));
     ob_start();
     $this->migration->launch();
     $error = ob_get_clean();
     $this->assertEquals('error', $error);
 }