You are here

protected function ConnectionUnitTest::getConnectionId in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php \Drupal\KernelTests\Core\Database\ConnectionUnitTest::getConnectionId()
  2. 10 core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php \Drupal\KernelTests\Core\Database\ConnectionUnitTest::getConnectionId()

Returns the connection ID of the current test connection.

Return value

int

4 calls to ConnectionUnitTest::getConnectionId()
ConnectionUnitTest::testOpenClose in core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php
Tests Database::closeConnection() without query.
ConnectionUnitTest::testOpenQueryClose in core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php
Tests Database::closeConnection() with a query.
ConnectionUnitTest::testOpenQueryPrefetchClose in core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php
Tests Database::closeConnection() with a query and custom prefetch method.
ConnectionUnitTest::testOpenSelectQueryClose in core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php
Tests Database::closeConnection() with a select query.

File

core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php, line 69

Class

ConnectionUnitTest
Tests management of database connections.

Namespace

Drupal\KernelTests\Core\Database

Code

protected function getConnectionId() {
  return (int) Database::getConnection(static::TEST_TARGET_CONNECTION)
    ->query('SELECT CONNECTION_ID()')
    ->fetchField();
}