function BrowserTestBase::cleanupEnvironment
Same name in other branches
- 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::cleanupEnvironment()
- 8.9.x core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::cleanupEnvironment()
- 11.x core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::cleanupEnvironment()
Clean up the test environment.
1 call to BrowserTestBase::cleanupEnvironment()
- BrowserTestBase::tearDown in core/
tests/ Drupal/ Tests/ BrowserTestBase.php
File
-
core/
tests/ Drupal/ Tests/ BrowserTestBase.php, line 427
Class
- BrowserTestBase
- Provides a test case for functional Drupal tests.
Namespace
Drupal\TestsCode
protected function cleanupEnvironment() {
// Remove all prefixed tables.
$original_connection_info = Database::getConnectionInfo('simpletest_original_default');
$original_prefix = $original_connection_info['default']['prefix'];
$test_connection_info = Database::getConnectionInfo('default');
$test_prefix = $test_connection_info['default']['prefix'];
if ($original_prefix != $test_prefix) {
$tables = Database::getConnection()->schema()
->findTables('%');
foreach ($tables as $table) {
if (Database::getConnection()->schema()
->dropTable($table)) {
unset($tables[$table]);
}
}
}
// Delete test site directory.
\Drupal::service('file_system')->deleteRecursive($this->siteDirectory, [
$this,
'filePreDeleteCallback',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.