function InstallerNonDefaultDatabaseDriverTest::setUpSettings

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php \Drupal\FunctionalTests\Installer\InstallerNonDefaultDatabaseDriverTest::setUpSettings()
  2. 10 core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php \Drupal\FunctionalTests\Installer\InstallerNonDefaultDatabaseDriverTest::setUpSettings()
  3. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php \Drupal\FunctionalTests\Installer\InstallerNonDefaultDatabaseDriverTest::setUpSettings()

Overrides InstallerTestBase::setUpSettings

File

core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php, line 30

Class

InstallerNonDefaultDatabaseDriverTest
Tests the interactive installer.

Namespace

Drupal\FunctionalTests\Installer

Code

protected function setUpSettings() {
    $driver = Database::getConnection()->driver();
    if (!in_array($driver, [
        'mysql',
        'pgsql',
    ])) {
        $this->markTestSkipped("This test does not support the {$driver} database driver.");
    }
    $this->testDriverName = 'Drivertest' . ucfirst($driver);
    // Assert that we are using the database drivers from the driver_test module.
    $this->assertSession()
        ->elementTextEquals('xpath', '//label[@for="edit-driver-drivertestmysql"]', 'MySQL by the driver_test module');
    $this->assertSession()
        ->elementTextEquals('xpath', '//label[@for="edit-driver-drivertestpgsql"]', 'PostgreSQL by the driver_test module');
    $settings = $this->parameters['forms']['install_settings_form'];
    $settings['driver'] = $this->testDriverName;
    $settings[$this->testDriverName] = $settings[$driver];
    unset($settings[$driver]);
    $edit = $this->translatePostValues($settings);
    $this->submitForm($edit, $this->translations['Save and continue']);
}

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