interface EnvironmentCleanerInterface (View source)

internal  
 

Defines an interface for cleaning up test results and fixtures.

This interface is marked internal. It does not imply an API.

Formalize this interface in https://www.drupal.org/project/drupal/issues/3075490 and https://www.drupal.org/project/drupal/issues/3075608

Methods

cleanEnvironment(bool $clear_results = TRUE, bool $clear_temp_directories = TRUE, bool $clear_database = TRUE)

Removes all test-related database tables and directories.

cleanDatabase()

Remove database entries left over in the fixture database.

cleanTemporaryDirectories()

Finds all leftover fixture site directories and removes them.

int
cleanResultsTable($test_id = NULL)

Clears test result tables from the results database.

Details

cleanEnvironment(bool $clear_results = TRUE, bool $clear_temp_directories = TRUE, bool $clear_database = TRUE)

Removes all test-related database tables and directories.

This method removes fixture files and database entries from the system under test.

Parameters

bool $clear_results

(optional) Whether to clear the test results database. Defaults to TRUE.

bool $clear_temp_directories

(optional) Whether to clear the test site directories. Defaults to TRUE.

bool $clear_database

(optional) Whether to clean up the fixture database. Defaults to TRUE.

cleanDatabase()

Remove database entries left over in the fixture database.

cleanTemporaryDirectories()

Finds all leftover fixture site directories and removes them.

int cleanResultsTable($test_id = NULL)

Clears test result tables from the results database.

Parameters

$test_id

Test ID to remove results for, or NULL to remove all results.

Return Value

int

The number of results that were removed.