function InstallerBrokenDatabaseCredentialsTest::prepareEnvironment

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php \Drupal\FunctionalTests\Installer\InstallerBrokenDatabaseCredentialsTest::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/InstallerBrokenDatabaseCredentialsTest.php, line 24

Class

InstallerBrokenDatabaseCredentialsTest
Tests the installer with incorrect connection info in settings.php.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function prepareEnvironment() {
  parent::prepareEnvironment();
  // Pre-configure database credentials in settings.php.
  $connection_info = Database::getConnectionInfo();
  if ($connection_info['default']['driver'] !== 'mysql') {
    $this->markTestSkipped('This test relies on overriding the mysql driver');
  }
  // Provide incorrect host name and test the new error messages.
  $connection_info['default']['host'] = 'localhost';
  $this->settings['databases']['default'] = (object) [
    'value' => $connection_info,
    'required' => TRUE,
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.