function InstallerNonDefaultDatabaseDriverTest::setUpSettings

Same name in other branches
  1. 9 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 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']);
}

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