function TestSetupTrait::getDatabaseConnection

Same name in other branches
  1. 9 core/lib/Drupal/Core/Test/TestSetupTrait.php \Drupal\Core\Test\TestSetupTrait::getDatabaseConnection()
  2. 8.9.x core/lib/Drupal/Core/Test/TestSetupTrait.php \Drupal\Core\Test\TestSetupTrait::getDatabaseConnection()

Returns the database connection to the site under test.

Return value

\Drupal\Core\Database\Connection The database connection to use for inserting assertions.

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. There is no replacement.

See also

https://www.drupal.org/node/3176816

1 call to TestSetupTrait::getDatabaseConnection()
TestSetupTraitTest::testGetDatabaseConnection in core/tests/Drupal/KernelTests/Core/Test/TestSetupTraitTest.php
@covers ::getDatabaseConnection @group legacy

File

core/lib/Drupal/Core/Test/TestSetupTrait.php, line 128

Class

TestSetupTrait
Provides a trait for shared test setup functionality.

Namespace

Drupal\Core\Test

Code

public static function getDatabaseConnection() {
    @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3176816', E_USER_DEPRECATED);
    return SimpletestTestRunResultsStorage::getConnection();
}

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