Chris@16: settings['settings']['hash_salt'] = (object) [ Chris@16: 'value' => __CLASS__, Chris@16: 'required' => TRUE, Chris@16: ]; Chris@16: Chris@16: // Pre-configure database credentials. Chris@16: $connection_info = Database::getConnectionInfo(); Chris@16: unset($connection_info['default']['pdo']); Chris@16: unset($connection_info['default']['init_commands']); Chris@16: Chris@16: $this->settings['databases']['default'] = (object) [ Chris@16: 'value' => $connection_info, Chris@16: 'required' => TRUE, Chris@16: ]; Chris@16: Chris@16: // During interactive install we'll change this to a different profile and Chris@16: // this test will ensure that the new value is written to settings.php. Chris@16: $this->settings['settings']['install_profile'] = (object) [ Chris@16: 'value' => 'minimal', Chris@16: 'required' => TRUE, Chris@16: ]; Chris@16: Chris@16: // Pre-configure config directories. Chris@16: $site_path = DrupalKernel::findSitePath(Request::createFromGlobals()); Chris@16: $this->settings['config_directories'] = [ Chris@16: CONFIG_SYNC_DIRECTORY => (object) [ Chris@16: 'value' => $site_path . '/files/config_staging', Chris@16: 'required' => TRUE, Chris@16: ], Chris@16: ]; Chris@16: mkdir($this->settings['config_directories'][CONFIG_SYNC_DIRECTORY]->value, 0777, TRUE); Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function visitInstaller() { Chris@16: // Make settings file not writable. This will break the installer. Chris@16: $filename = $this->siteDirectory . '/settings.php'; Chris@16: // Make the settings file read-only. Chris@16: // Not using File API; a potential error must trigger a PHP warning. Chris@16: chmod($filename, 0444); Chris@16: Chris@16: $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=testing'); Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpLanguage() { Chris@16: // This step is skipped, because there is a lagcode as a query param. Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpProfile() { Chris@16: // This step is skipped, because there is a profile as a query param. Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpSettings() { Chris@16: // This step should not appear, since settings.php is fully configured Chris@16: // already. Chris@16: } Chris@16: Chris@16: protected function setUpSite() { Chris@16: // This step should not appear, since settings.php could not be written. Chris@16: } Chris@16: Chris@16: /** Chris@16: * Verifies that installation did not succeed. Chris@16: */ Chris@16: public function testBrokenInstaller() { Chris@16: $this->assertTitle('Install profile mismatch | Drupal'); Chris@16: $this->assertText("The selected profile testing does not match the install_profile setting, which is minimal. Cannot write updated setting to {$this->siteDirectory}/settings.php."); Chris@16: } Chris@16: Chris@16: }