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