simpletest.install

Same filename and directory in other branches
  1. 7.x modules/simpletest/simpletest.install
  2. 8.9.x core/modules/simpletest/simpletest.install

Uninstall functions for the simpletest module.

File

core/modules/simpletest/simpletest.install

View source
<?php


/**
 * @file
 * Uninstall functions for the simpletest module.
 */

use Drupal\Core\Database\Database;
use Drupal\Core\File\Exception\FileException;
use Drupal\Core\Test\EnvironmentCleaner;
use Drupal\Core\Test\TestDatabase;
use Symfony\Component\Console\Output\NullOutput;

/**
 * Implements hook_schema().
 */
function simpletest_schema() {
  return TestDatabase::testingSchema();
}

/**
 * Implements hook_uninstall().
 */
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.
  }
}

Functions

Title Deprecated Summary
simpletest_schema Implements hook_schema().
simpletest_uninstall Implements hook_uninstall().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.