diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 9654f9c..71c040d 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -690,6 +690,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');
@@ -735,6 +737,10 @@ protected function prepareEnvironment() {
       $this->configDirectories[$type] = $this->originalFileDirectory . '/' . $path;
     }
 
+    // Unset globals.
+    unset($GLOBALS['theme_key']);
+    unset($GLOBALS['theme']);
+
     // Log fatal errors.
     ini_set('log_errors', 1);
     ini_set('error_log', $this->public_files_directory . '/error.log');
@@ -778,6 +784,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();
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
index 9421682..533b446 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
@@ -215,14 +215,6 @@ function testRenderOverride() {
     $styles = drupal_get_css();
     $this->assert(strpos($styles, $system . '/tests/system.base.css') !== FALSE, t('The overriding CSS file is output.'));
     $this->assert(strpos($styles, $system . '/system.base.css') === FALSE, t('The overridden CSS file is not output.'));
-
-    drupal_add_css($system . '/tests/system.base.css');
-    drupal_add_css($system . '/system.base.css');
-
-    // The standard stylesheet should be the only one included.
-    $styles = drupal_get_css();
-    $this->assert(strpos($styles, $system . '/system.base.css') !== FALSE, t('The overriding CSS file is output.'));
-    $this->assert(strpos($styles, $system . '/tests/system.base.css') === FALSE, t('The overridden CSS file is not output.'));
   }
 
   /**
