protected function KernelTestBase::tearDown in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::tearDown()
- 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::tearDown()
3 calls to KernelTestBase::tearDown()
- GenericCacheBackendUnitTestBase::tearDown in core/
tests/ Drupal/ KernelTests/ Core/ Cache/ GenericCacheBackendUnitTestBase.php - KernelTestBaseTest::tearDown in core/
tests/ Drupal/ KernelTests/ KernelTestBaseTest.php - RouteProviderTest::tearDown in core/
tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php
3 methods override KernelTestBase::tearDown()
- GenericCacheBackendUnitTestBase::tearDown in core/
tests/ Drupal/ KernelTests/ Core/ Cache/ GenericCacheBackendUnitTestBase.php - KernelTestBaseTest::tearDown in core/
tests/ Drupal/ KernelTests/ KernelTestBaseTest.php - RouteProviderTest::tearDown in core/
tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php
File
- core/
tests/ Drupal/ KernelTests/ KernelTestBase.php, line 637
Class
- KernelTestBase
- Base class for functional integration tests.
Namespace
Drupal\KernelTestsCode
protected function tearDown() : void {
// Destroy the testing kernel.
if (isset($this->kernel)) {
$this->kernel
->shutdown();
}
// Remove all prefixed tables.
$original_connection_info = Database::getConnectionInfo('simpletest_original_default');
$original_prefix = $original_connection_info['default']['prefix'] ?? NULL;
$test_connection_info = Database::getConnectionInfo('default');
$test_prefix = $test_connection_info['default']['prefix'] ?? NULL;
if ($original_prefix != $test_prefix) {
$tables = Database::getConnection()
->schema()
->findTables('%');
foreach ($tables as $table) {
if (Database::getConnection()
->schema()
->dropTable($table)) {
unset($tables[$table]);
}
}
}
// Free up memory: Own properties.
$this->classLoader = NULL;
$this->vfsRoot = NULL;
$this->configImporter = NULL;
// Clean FileCache cache.
FileCache::reset();
// Clean up statics, container, and settings.
if (function_exists('drupal_static_reset')) {
drupal_static_reset();
}
\Drupal::unsetContainer();
$this->container = NULL;
new Settings([]);
parent::tearDown();
}