You are here

protected function EndOfTransactionQueriesTest::getDatabaseConnectionInfo in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php \Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest::getDatabaseConnectionInfo()

Returns the Database connection info to be used for this test.

This method only exists for tests of the Database component itself, because they require multiple database connections. Each SQLite :memory: connection creates a new/separate database in memory. A shared-memory SQLite file URI triggers PHP open_basedir/allow_url_fopen/allow_url_include restrictions. Due to that, Database tests are running against a SQLite database that is located in an actual file in the system's temporary directory.

Other tests should not override this method.

@internal

Return value

array A Database connection info array.

Overrides KernelTestBase::getDatabaseConnectionInfo

File

core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php, line 178

Class

EndOfTransactionQueriesTest
Tests that cache tag invalidation queries are delayed to the end of transactions.

Namespace

Drupal\KernelTests\Core\Cache

Code

protected function getDatabaseConnectionInfo() {
  $info = parent::getDatabaseConnectionInfo();

  // Override default database driver to one that does logging. Third-party
  // (non-core) database drivers can achieve the same test coverage by
  // subclassing this test class and overriding only this method.
  // @see \Drupal\database_statement_monitoring_test\LoggedStatementsTrait
  // @see \Drupal\database_statement_monitoring_test\mysql\Connection
  // @see \Drupal\database_statement_monitoring_test\pgsql\Connection
  // @see \Drupal\database_statement_monitoring_test\sqlite\Connection
  $info['default']['namespace'] = '\\Drupal\\database_statement_monitoring_test\\' . $info['default']['driver'];
  return $info;
}