function KernelTestBase::tearDownCloseDatabaseConnection

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::tearDownCloseDatabaseConnection()
  2. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::tearDownCloseDatabaseConnection()
  3. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::tearDownCloseDatabaseConnection()

Additional tear down method to close the connection at the end.

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 704

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

public function tearDownCloseDatabaseConnection() {
    // Destroy the database connection, which for example removes the memory
    // from sqlite in memory.
    foreach (Database::getAllConnectionInfo() as $key => $targets) {
        Database::removeConnection($key);
    }
}

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