You are here

protected function InstallerExistingDatabaseSettingsTest::prepareEnvironment in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php \Drupal\FunctionalTests\Installer\InstallerExistingDatabaseSettingsTest::prepareEnvironment()
  2. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php \Drupal\FunctionalTests\Installer\InstallerExistingDatabaseSettingsTest::prepareEnvironment()

Prepares the current environment for running the test.

Also sets up new resources for the testing environment, such as the public filesystem and configuration directories.

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php, line 23

Class

InstallerExistingDatabaseSettingsTest
Tests the installer with an existing settings file with database connection info.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
  parent::prepareEnvironment();

  // Pre-configure database credentials in settings.php.
  $connection_info = Database::getConnectionInfo();
  unset($connection_info['default']['pdo']);
  unset($connection_info['default']['init_commands']);
  $this->settings['databases']['default'] = (object) [
    'value' => $connection_info,
    'required' => TRUE,
  ];
}