function InstallerNonDefaultDatabaseDriverTest::setUpSettings

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php \Drupal\FunctionalTests\Installer\InstallerNonDefaultDatabaseDriverTest::setUpSettings()
  2. 8.9.x 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 35

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.");
    }
    $driverNamespace = Database::getConnection()->getConnectionOptions()['namespace'];
    $this->testDriverName = 'Drivertest' . ucfirst($driver);
    $testDriverNamespace = "Drupal\\driver_test\\Driver\\Database\\{$this->testDriverName}";
    // Assert that we are using the database drivers from the driver_test module.
    $this->assertSession()
        ->elementTextEquals('xpath', '//label[@for="edit-driver-drupaldriver-testdriverdatabasedrivertestmysql"]', 'MySQL by the driver_test module');
    $this->assertSession()
        ->elementTextEquals('xpath', '//label[@for="edit-driver-drupaldriver-testdriverdatabasedrivertestpgsql"]', 'PostgreSQL by the driver_test module');
    $settings = $this->parameters['forms']['install_settings_form'];
    $settings['driver'] = $testDriverNamespace;
    $settings[$testDriverNamespace] = $settings[$driverNamespace];
    unset($settings[$driverNamespace]);
    $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.