EnvironmentCleanerInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Drupal\Core\Test;
  3. /**
  4. * Defines an interface for cleaning up test results and fixtures.
  5. *
  6. * This interface is marked internal. It does not imply an API.
  7. *
  8. * @todo Formalize this interface in
  9. * https://www.drupal.org/project/drupal/issues/3075490 and
  10. * https://www.drupal.org/project/drupal/issues/3075608
  11. *
  12. * @see https://www.drupal.org/project/drupal/issues/3075490
  13. * @see https://www.drupal.org/project/drupal/issues/3075608
  14. *
  15. * @internal
  16. */
  17. interface EnvironmentCleanerInterface {
  18. /**
  19. * Removes all test-related database tables and directories.
  20. *
  21. * This method removes fixture files and database entries from the system
  22. * under test.
  23. *
  24. * @param bool $clear_results
  25. * (optional) Whether to clear the test results database. Defaults to TRUE.
  26. * @param bool $clear_temp_directories
  27. * (optional) Whether to clear the test site directories. Defaults to TRUE.
  28. * @param bool $clear_database
  29. * (optional) Whether to clean up the fixture database. Defaults to TRUE.
  30. */
  31. public function cleanEnvironment($clear_results = TRUE, $clear_temp_directories = TRUE, $clear_database = TRUE);
  32. /**
  33. * Remove database entries left over in the fixture database.
  34. */
  35. public function cleanDatabase();
  36. /**
  37. * Finds all leftover fixture site directories and removes them.
  38. */
  39. public function cleanTemporaryDirectories();
  40. /**
  41. * Clears test result tables from the results database.
  42. *
  43. * @param $test_id
  44. * Test ID to remove results for, or NULL to remove all results.
  45. *
  46. * @return int
  47. * The number of results that were removed.
  48. */
  49. public function cleanResultsTable($test_id = NULL);
  50. }