You are here

protected function InstallerNonDefaultDatabaseDriverTest::setUpSettings in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php \Drupal\FunctionalTests\Installer\InstallerNonDefaultDatabaseDriverTest::setUpSettings()

Installer step: Configure settings.

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']);
}