public function testLaunchException() { $this->objectManagerMock->expects($this->once())->method('configure')->with($this->getPreferences()); $code = key($this->getOptions()); $arguments = current($this->getOptions()); $exception = new Task\OperationException('Unrecognized operation', Task\OperationException::UNAVAILABLE_OPERATION); $this->taskManagerMock->expects($this->once())->method('addOperation')->with($code, $arguments)->willThrowException($exception); $this->taskManagerMock->expects($this->never())->method('process'); $this->responseMock->expects($this->once())->method('setCode')->with(\Magento\Framework\App\Console\Response::ERROR); $this->assertInstanceOf('\\Magento\\Framework\\App\\Console\\Response', $this->model->launch()); }