function InstallerBrokenDatabasePortSettingsTest::prepareEnvironment

Same name in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php \Drupal\FunctionalTests\Installer\InstallerBrokenDatabasePortSettingsTest::prepareEnvironment()

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php, line 24

Class

InstallerBrokenDatabasePortSettingsTest
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');
    }
    // Override the port number to random port.
    $connection_info['default']['port'] = 1234;
    $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.