You are here

protected function ConnectionUnitTest::setUp 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::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php \Drupal\KernelTests\Core\Database\ConnectionUnitTest::setUp()

Overrides KernelTestBase::setUp

File

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

Class

ConnectionUnitTest
Tests management of database connections.

Namespace

Drupal\KernelTests\Core\Database

Code

protected function setUp() : void {
  parent::setUp();
  $this->connection = Database::getConnection();

  // Create an additional connection to monitor the connections being opened
  // and closed in this test.
  $connection_info = Database::getConnectionInfo();
  Database::addConnectionInfo('default', 'monitor', $connection_info['default']);
  $this->monitor = Database::getConnection('monitor');
}