Commit a7c17d91 authored by webchick's avatar webchick

Issue #1770902 by sun, tim.plunkett: Fixed Theme of parent site executing test...

Issue #1770902 by sun, tim.plunkett: Fixed Theme of parent site executing test leaks into all tests.
parent 2941c8a1
......@@ -692,6 +692,8 @@ protected function prepareEnvironment() {
$this->originalContainer = clone drupal_container();
$this->originalLanguage = $language_interface;
$this->originalConfigDirectories = $GLOBALS['config_directories'];
$this->originalThemeKey = $GLOBALS['theme_key'];
$this->originalTheme = $GLOBALS['theme'];
// Save further contextual information.
$this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files');
......@@ -740,6 +742,15 @@ protected function prepareEnvironment() {
$this->configDirectories[$type] = $this->originalFileDirectory . '/' . $path;
}
// Unset globals.
unset($GLOBALS['theme_key']);
unset($GLOBALS['theme']);
// Re-initialize the theme to ensure that tests do not see an inconsistent
// behavior when calling functions that would initialize the theme if it has
// not been initialized yet.
drupal_theme_initialize();
// Log fatal errors.
ini_set('log_errors', 1);
ini_set('error_log', $this->public_files_directory . '/error.log');
......@@ -783,6 +794,10 @@ protected function tearDown() {
Database::removeConnection('default');
Database::renameConnection('simpletest_original_default', 'default');
// Restore original globals.
$GLOBALS['theme_key'] = $this->originalThemeKey;
$GLOBALS['theme'] = $this->originalTheme;
// Reset all static variables.
drupal_static_reset();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment