function ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest::testExistingDrupal8StyleDatabaseConnectionInSettingsPhp
Same name in other branches
- 9 core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php \Drupal\FunctionalTests\ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest::testExistingDrupal8StyleDatabaseConnectionInSettingsPhp()
- 10 core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php \Drupal\FunctionalTests\ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest::testExistingDrupal8StyleDatabaseConnectionInSettingsPhp()
Confirms that the site works with Drupal 8 style database connection array.
File
-
core/
tests/ Drupal/ FunctionalTests/ ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php, line 60
Class
- ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest
- @group Database
Namespace
Drupal\FunctionalTestsCode
public function testExistingDrupal8StyleDatabaseConnectionInSettingsPhp() : void {
$this->drupalLogin($this->drupalCreateUser());
$this->assertSession()
->addressEquals('user/2');
$this->assertSession()
->statusCodeEquals(200);
// Make sure that we are have tested with the Drupal 8 style database
// connection array.
$filename = $this->siteDirectory . '/settings.php';
$contents = file_get_contents($filename);
$driver = Database::getConnection()->driver();
$this->assertStringContainsString("'namespace' => 'Drupal\\\\Core\\\\Database\\\\Driver\\\\{$driver}',", $contents);
$this->assertStringContainsString("'driver' => '{$driver}',", $contents);
$this->assertStringNotContainsString("'autoload' => 'core/modules/{$driver}/src/Driver/Database/{$driver}/", $contents);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.