You are here

protected function ConnectionUnitTest::assertConnection in Drupal 10

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

Asserts that a connection ID exists.

@internal

Parameters

int $id: The connection ID to verify.

File

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

Class

ConnectionUnitTest
Tests management of database connections.

Namespace

Drupal\KernelTests\Core\Database

Code

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