/** * Run application * * @return \Magento\Framework\App\ResponseInterface */ public function launch() { $areaCode = 'install'; $this->_state->setAreaCode($areaCode); $this->_objectManager->configure($this->_loader->load($areaCode)); if (isset($this->_arguments['uninstall'])) { $sessionConsole = $this->_objectManager->create('\\Magento\\Framework\\Session\\SessionConsole'); $installerModel = $this->_objectManager->create('Magento\\Install\\Model\\Installer', ['session' => $sessionConsole]); $installer = $this->_installerFactory->create(['installArgs' => $this->_arguments, 'installer' => $installerModel]); } else { $installer = $this->_installerFactory->create(array('installArgs' => $this->_arguments)); } if (isset($this->_arguments['show_locales'])) { $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableLocales())); } elseif (isset($this->_arguments['show_currencies'])) { $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableCurrencies())); } elseif (isset($this->_arguments['show_timezones'])) { $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableTimezones())); } elseif (isset($this->_arguments['show_install_options'])) { $this->_output->readableOutput(PHP_EOL . 'Required parameters:'); $this->_output->readableOutput($this->_output->alignArrayKeys($installer->getRequiredParams())); $this->_output->readableOutput(PHP_EOL . 'Optional parameters:'); $this->_output->readableOutput($this->_output->alignArrayKeys($installer->getOptionalParams())); $this->_output->readableOutput(PHP_EOL . 'Flag values are considered positive if set to 1, y, true or yes.' . 'Any other value is considered as negative.' . PHP_EOL); } else { $this->_handleInstall($installer); } $this->_response->setCode(0); return $this->_response; }
public function testExecuteReportsErrors() { $model = $this->_createModel(array('uninstall' => true)); $this->_installerMock->expects($this->once())->method('hasErrors')->will($this->returnValue(true)); $this->_installerMock->expects($this->once())->method('getErrors')->will($this->returnValue(array('error1'))); $this->_outputMock->expects($this->once())->method('error')->with($this->stringContains('error1')); $this->assertEquals($this->_responseMock, $model->launch()); }