Example #1
0
 /**
  * Install application according to installation options
  *
  * @return \Magento\TestFramework\Application
  * @throws \Magento\Framework\Exception
  */
 protected function _install()
 {
     $installOptions = $this->_config->getInstallOptions();
     $installOptionsNoValue = $this->_config->getInstallOptionsNoValue();
     if (!$installOptions) {
         throw new \Magento\Framework\Exception('Trying to install Magento, but installation options are not set');
     }
     // Populate install options with global options
     $baseUrl = 'http://' . $this->_config->getApplicationUrlHost() . $this->_config->getApplicationUrlPath();
     $installOptions = array_merge($installOptions, ['base_url' => $baseUrl, 'base_url_secure' => $baseUrl]);
     $installCmd = 'php -f %s install';
     $installCmdArgs = [$this->_script];
     foreach ($installOptions as $optionName => $optionValue) {
         $installCmd .= " --{$optionName}=%s";
         $installCmdArgs[] = $optionValue;
     }
     foreach ($installOptionsNoValue as $optionName) {
         $installCmd .= " --{$optionName}";
     }
     $this->_shell->execute($installCmd, $installCmdArgs);
     $this->_isInstalled = true;
     $this->_fixtures = [];
     return $this;
 }