You are here

interface EnvironmentCleanerInterface in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php \Drupal\Core\Test\EnvironmentCleanerInterface
  2. 10 core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php \Drupal\Core\Test\EnvironmentCleanerInterface

Defines an interface for cleaning up test results and fixtures.

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

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

@internal

Hierarchy

Expanded class hierarchy of EnvironmentCleanerInterface

All classes that implement EnvironmentCleanerInterface

See also

https://www.drupal.org/project/drupal/issues/3075490

https://www.drupal.org/project/drupal/issues/3075608

File

core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php, line 19

Namespace

Drupal\Core\Test
View source
interface EnvironmentCleanerInterface {

  /**
   * Removes all test-related database tables and directories.
   *
   * This method removes fixture files and database entries from the system
   * under test.
   *
   * @param bool $clear_results
   *   (optional) Whether to clear the test results database. Defaults to TRUE.
   * @param bool $clear_temp_directories
   *   (optional) Whether to clear the test site directories. Defaults to TRUE.
   * @param bool $clear_database
   *   (optional) Whether to clean up the fixture database. Defaults to TRUE.
   */
  public function cleanEnvironment($clear_results = TRUE, $clear_temp_directories = TRUE, $clear_database = TRUE);

  /**
   * Remove database entries left over in the fixture database.
   */
  public function cleanDatabase();

  /**
   * Finds all leftover fixture site directories and removes them.
   */
  public function cleanTemporaryDirectories();

  /**
   * Clears test result tables from the results database.
   *
   * @param $test_id
   *   Test ID to remove results for, or NULL to remove all results.
   *
   * @return int
   *   The number of results that were removed.
   */
  public function cleanResultsTable($test_id = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
EnvironmentCleanerInterface::cleanDatabase public function Remove database entries left over in the fixture database. 1
EnvironmentCleanerInterface::cleanEnvironment public function Removes all test-related database tables and directories. 1
EnvironmentCleanerInterface::cleanResultsTable public function Clears test result tables from the results database. 1
EnvironmentCleanerInterface::cleanTemporaryDirectories public function Finds all leftover fixture site directories and removes them. 1