You are here

function simpletest_uninstall in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/simpletest/simpletest.install \simpletest_uninstall()
  2. 7 modules/simpletest/simpletest.install \simpletest_uninstall()

Implements hook_uninstall().

File

core/modules/simpletest/simpletest.install, line 24
Uninstall functions for the simpletest module.

Code

function simpletest_uninstall() {

  // Do not clean the environment in case the Simpletest module is uninstalled
  // in a (recursive) test for itself, since EnvironmentCleaner would also
  // delete the test site of the parent test process.
  if (!drupal_valid_test_ua()) {

    // Clean up left-over tables and directories.
    $cleaner = new EnvironmentCleaner(DRUPAL_ROOT, Database::getConnection(), TestDatabase::getConnection(), new NullOutput(), \Drupal::service('file_system'));
    try {
      $cleaner
        ->cleanEnvironment();
    } catch (Exception $e) {

      // Ignore.
    }
  }

  // Delete verbose test output and any other testing framework files.
  try {
    \Drupal::service('file_system')
      ->deleteRecursive('public://simpletest');
  } catch (FileException $e) {

    // Ignore.
  }
}