You are here

protected function InstallerNonDefaultDatabaseDriverTest::setUpSettings in Drupal 8

Same name and namespace in other branches
  1. 9 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 28

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.
  $elements = $this
    ->xpath('//label[@for="edit-driver-drivertestmysql"]');
  $this
    ->assertEqual(current($elements)
    ->getText(), 'MySQL by the driver_test module');
  $elements = $this
    ->xpath('//label[@for="edit-driver-drivertestpgsql"]');
  $this
    ->assertEqual(current($elements)
    ->getText(), '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
    ->drupalPostForm(NULL, $edit, $this->translations['Save and continue']);
}