Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Mile23 on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.8.x
Introduced in version:
8.8.0-alpha1
Issue links:
Description:
In order to further isolate the simpletest module from core's test runner infrastructure, simpletest_clean_*()
functions have been moved to some environmental cleaner classes.
These functions have been deprecated:
simpletest_clean_environment()
simpletest_clean_database()
simpletest_clean_temporary_directories()
simpletest_clean_results_table()
These have been replaced by classes which implement the Drupal\Core\Test\EnvironmentCleanerInterface
interface:
Drupal\Core\Test\EnvironmentCleanerInterface::cleanEnvironment($clear_results = TRUE, $clear_temp_directories = TRUE, $clear_database = TRUE)
Drupal\Core\Test\EnvironmentCleanerInterface::cleanDatabase()
Drupal\Core\Test\EnvironmentCleanerInterface::cleanTemporaryDirectories()
Drupal\Core\Test\EnvironmentCleanerInterface::cleanResultsTable($test_id = NULL)
Within the simpletest module, developers should access the environment_cleaner
service and call the desired method.
In other contexts, developers should create a new Drupal\Core\Test\EnvironmentCleaner
object and use it to clean up after tests.