function ConnectionUnitTest::setUp

Same name in other branches
  1. 7.x modules/simpletest/tests/database_test.test \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() {
    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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.