1 backdrop_web_test_case_cache.php protected BackdropWebTestCaseCache::tearDown()

Reset the database prefix and global config.

Overrides BackdropWebTestCase::tearDown

File

core/modules/simpletest/backdrop_web_test_case_cache.php, line 115

Class

BackdropWebTestCaseCache
Class for setting up a full installation profile for caching purposes.

Code

protected function tearDown() {
  global $user, $language, $settings, $config_directories;
  // Get back to the original connection.
  Database::removeConnection('default');
  Database::renameConnection('simpletest_original_default', 'default');

  // Set the configuration directories back to the originals.
  $config_directories = $this->originalConfigDirectories;

  // Restore the original settings.
  $settings = $this->originalSettings;

  // Restore original shutdown callbacks array to prevent original
  // environment of calling handlers from test run.
  $callbacks = &backdrop_register_shutdown_function();
  $callbacks = $this->originalShutdownCallbacks;

  // Return the user to the original one.
  $user = $this->originalUser;
  backdrop_save_session(TRUE);

  // Ensure that internal logged in variable and cURL options are reset.
  $this->loggedInUser = FALSE;
  $this->additionalCurlOptions = array();

  // Reload module list and implementations to ensure that test module hooks
  // aren't called after tests.
  module_list(TRUE);
  module_implements_reset();

  // Reset the Field API.
  field_cache_clear();

  // Rebuild caches.
  $this->refreshVariables();

  // Reset public files directory.
  $GLOBALS['conf']['file_public_path'] = $this->originalFileDirectory;

  // Reset language.
  $language = $this->originalLanguage;
  if ($this->originalLanguageDefault) {
    $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
  }

  // Close the CURL handler.
  $this->curlClose();
}