Chris@17: settings['settings']['hash_salt'] = (object) [ Chris@17: 'value' => __CLASS__, Chris@17: 'required' => TRUE, Chris@17: ]; Chris@17: Chris@17: // Pre-configure database credentials. Chris@17: $connection_info = Database::getConnectionInfo(); Chris@17: unset($connection_info['default']['pdo']); Chris@17: unset($connection_info['default']['init_commands']); Chris@17: Chris@17: $this->settings['databases']['default'] = (object) [ Chris@17: 'value' => $connection_info, Chris@17: 'required' => TRUE, Chris@17: ]; Chris@17: Chris@17: // During interactive install we'll change this to a different profile and Chris@17: // this test will ensure that the new value is written to settings.php. Chris@17: $this->settings['settings']['install_profile'] = (object) [ Chris@17: 'value' => 'minimal', Chris@17: 'required' => TRUE, Chris@17: ]; Chris@17: Chris@17: // Pre-configure config directories. Chris@17: $site_path = DrupalKernel::findSitePath(Request::createFromGlobals()); Chris@17: $this->settings['config_directories'] = [ Chris@17: CONFIG_SYNC_DIRECTORY => (object) [ Chris@17: 'value' => $site_path . '/files/config_staging', Chris@17: 'required' => TRUE, Chris@17: ], Chris@17: ]; Chris@17: mkdir($this->settings['config_directories'][CONFIG_SYNC_DIRECTORY]->value, 0777, TRUE); Chris@17: } Chris@17: Chris@17: /** Chris@17: * {@inheritdoc} Chris@17: */ Chris@17: protected function visitInstaller() { Chris@17: // Make settings file not writable. This will break the installer. Chris@17: $filename = $this->siteDirectory . '/settings.php'; Chris@17: // Make the settings file read-only. Chris@17: // Not using File API; a potential error must trigger a PHP warning. Chris@17: chmod($filename, 0444); Chris@17: Chris@17: $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=testing'); Chris@17: } Chris@17: Chris@17: /** Chris@17: * {@inheritdoc} Chris@17: */ Chris@17: protected function setUpLanguage() { Chris@17: // This step is skipped, because there is a lagcode as a query param. Chris@17: } Chris@17: Chris@17: /** Chris@17: * {@inheritdoc} Chris@17: */ Chris@17: protected function setUpProfile() { Chris@17: // This step is skipped, because there is a profile as a query param. Chris@17: } Chris@17: Chris@17: /** Chris@17: * {@inheritdoc} Chris@17: */ Chris@17: protected function setUpSettings() { Chris@17: // This step should not appear, since settings.php is fully configured Chris@17: // already. Chris@17: } Chris@17: Chris@17: /** Chris@17: * Verifies that installation succeeded. Chris@17: * Chris@17: * @expectedDeprecation To access the install profile in Drupal 8 use \Drupal::installProfile() or inject the install_profile container parameter into your service. See https://www.drupal.org/node/2538996 Chris@17: */ Chris@17: public function testInstalled() { Chris@17: $this->initBrowserOutputFile(); Chris@17: $this->htmlOutput(NULL); Chris@17: $this->assertEquals('testing', \Drupal::installProfile()); Chris@17: $this->assertEquals('minimal', Settings::get('install_profile')); Chris@17: $this->drupalGet('admin/reports/status'); Chris@17: $this->assertSession()->pageTextContains("Drupal 8 no longer uses the \$settings['install_profile'] value in settings.php and it can be removed."); Chris@17: } Chris@17: Chris@17: }