protected function BrowserTestBase::cleanupEnvironment in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::cleanupEnvironment()
- 10 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::cleanupEnvironment()
Clean up the Simpletest environment.
1 call to BrowserTestBase::cleanupEnvironment()
- BrowserTestBase::tearDown in core/
tests/ Drupal/ Tests/ BrowserTestBase.php
File
- core/
tests/ Drupal/ Tests/ BrowserTestBase.php, line 424
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',
]);
}