You are here

protected function ConnectionUnitTest::assertNoConnection in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php \Drupal\KernelTests\Core\Database\ConnectionUnitTest::assertNoConnection()

Asserts that a connection ID does not exist.

Parameters

int $id: The connection ID to verify.

4 calls to ConnectionUnitTest::assertNoConnection()
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 110

Class

ConnectionUnitTest
Tests management of database connections.

Namespace

Drupal\KernelTests\Core\Database

Code

protected function assertNoConnection($id) {
  $list = $this->monitor
    ->query($this
    ->getQuery()['processlist'])
    ->fetchAllKeyed(0, 0);
  $this
    ->assertFalse(isset($list[$id]), new FormattableMarkup('Connection ID @id not found.', [
    '@id' => $id,
  ]));
}