diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 3453b2a..bd24a7a 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2436,6 +2436,16 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
     // requests.
     $container = new ContainerBuilder();
 
+    // Database.
+    $container->register('database', 'Drupal\Core\Database\Connection')
+      ->setFactoryClass('Drupal\Core\Database\Database')
+      ->setFactoryMethod('getConnection')
+      ->addArgument('default');
+    $container->register('database.slave', 'Drupal\Core\Database\Connection')
+      ->setFactoryClass('Drupal\Core\Database\Database')
+      ->setFactoryMethod('getConnection')
+      ->addArgument('slave');
+
     // Register active configuration storage.
     $container
       ->register('config.cachedstorage.storage', 'Drupal\Core\Config\FileStorage')
@@ -2467,7 +2477,8 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
 
     // Register the KeyValueStore factory.
     $container
-      ->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory');
+      ->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory')
+      ->addArgument('Drupal\Core\KeyValueStore\DatabaseStorage');
   }
   return $container;
 }
diff --git a/core/includes/config.inc b/core/includes/config.inc
index 5e07c54..ef43774 100644
--- a/core/includes/config.inc
+++ b/core/includes/config.inc
@@ -157,8 +157,6 @@ function config_import() {
   try {
     $remaining_changes = config_import_invoke_owner($config_changes, $source_storage, $target_storage);
     config_sync_changes($remaining_changes, $source_storage, $target_storage);
-    // Flush all caches and reset static variables after a successful import.
-    drupal_flush_all_caches();
   }
   catch (ConfigException $e) {
     watchdog_exception('config_import', $e);
diff --git a/core/includes/module.inc b/core/includes/module.inc
index c1d99f2..70db601 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -182,7 +182,7 @@ function system_list($type) {
       // Drupal installations, which might have modules installed in different
       // locations in the file system. The ordering here must also be
       // consistent with the one used in module_implements().
-      $enabled_modules = config('system.module')->get('enabled');
+      $enabled_modules = (array) config('system.module')->get('enabled');
       $module_files = state()->get('system.module.files');
       foreach ($enabled_modules as $name => $weight) {
         // Build a list of all enabled modules.
@@ -196,7 +196,7 @@ function system_list($type) {
       }
 
       // Build a list of themes.
-      $enabled_themes = config('system.theme')->get('enabled');
+      $enabled_themes = (array) config('system.theme')->get('enabled');
       // @todo Themes include all themes, including disabled/uninstalled. This
       //   system.theme.data state will go away entirely as soon as themes have
       //   a proper installation status.
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index f1e43d6..b0deb18 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -46,14 +46,6 @@ public function build(ContainerBuilder $container) {
     $container->register('language_manager', 'Drupal\Core\Language\LanguageManager')
       ->addArgument(new Reference('request'))
       ->setScope('request');
-    $container->register('database', 'Drupal\Core\Database\Connection')
-      ->setFactoryClass('Drupal\Core\Database\Database')
-      ->setFactoryMethod('getConnection')
-      ->addArgument('default');
-    $container->register('database.slave', 'Drupal\Core\Database\Connection')
-      ->setFactoryClass('Drupal\Core\Database\Database')
-      ->setFactoryMethod('getConnection')
-      ->addArgument('slave');
     $container->register('typed_data', 'Drupal\Core\TypedData\TypedDataManager');
     // Add the user's storage for temporary, non-cache data.
     $container->register('lock', 'Drupal\Core\Lock\DatabaseLockBackend');
diff --git a/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php b/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php
index 7edb754..a1aaa60 100644
--- a/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php
+++ b/core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php
@@ -12,6 +12,8 @@
  */
 class KeyValueFactory {
 
+  protected $backend;
+
   /**
    * Instantiated stores, keyed by collection name.
    *
@@ -20,6 +22,17 @@ class KeyValueFactory {
   protected $stores = array();
 
   /**
+   * Constructs the key/value store factory.
+   *
+   * @param string $backend
+   *   The fully-qualified class name of backend implementing
+   *   KeyValueStoreInterface.
+   */
+  function __construct($backend) {
+    $this->backend = $backend;
+  }
+
+  /**
    * Constructs a new key/value store for a given collection name.
    *
    * @param string $collection
@@ -30,7 +43,7 @@ class KeyValueFactory {
    */
   public function get($collection) {
     if (!isset($this->stores[$collection])) {
-      $this->stores[$collection] = new DatabaseStorage($collection);
+      $this->stores[$collection] = new $this->backend($collection);
     }
     return $this->stores[$collection];
   }
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php
index 35facea..31aa81c 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php
@@ -7,12 +7,12 @@
 
 namespace Drupal\config\Tests;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Tests CRUD operations on configuration objects.
  */
-class ConfigCRUDTest extends WebTestBase {
+class ConfigCRUDTest extends DrupalUnitTestBase {
   public static function getInfo() {
     return array(
       'name' => 'CRUD operations',
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php
index b3eea43..f2e7965 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php
@@ -8,12 +8,12 @@
 namespace Drupal\config\Tests;
 
 use Drupal\Core\Config\FileStorage;
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Tests reading and writing file contents.
  */
-class ConfigFileContentTest extends WebTestBase {
+class ConfigFileContentTest extends DrupalUnitTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File content',
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php
index b659ace..189d13b 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php
@@ -7,12 +7,12 @@
 
 namespace Drupal\config\Tests;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Tests importing configuration from files into active configuration.
  */
-class ConfigImportTest extends WebTestBase {
+class ConfigImportTest extends DrupalUnitTestBase {
 
   /**
    * Modules to enable.
@@ -32,7 +32,10 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
 
-    // Clear out any possibly existing hook invocation records.
+    config_install_default_config('module', 'config_test');
+    // Installing config_test's default configuration pollutes the global
+    // variable being used for recording hook invocations by this test already,
+    // so it has to be cleared out manually.
     unset($GLOBALS['hook_config_test']);
   }
 
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php
index 3e6a88e..b549119 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php
@@ -7,12 +7,12 @@
 
 namespace Drupal\config\Tests;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Tests installation of configuration objects in installation functionality.
  */
-class ConfigInstallTest extends WebTestBase {
+class ConfigInstallTest extends DrupalUnitTestBase {
   public static function getInfo() {
     return array(
       'name' => 'Installation functionality',
@@ -21,6 +21,14 @@ public static function getInfo() {
     );
   }
 
+  function setUp() {
+    parent::setUp();
+
+    // Ensure the global variable being asserted by this test does not exist;
+    // a previous test executed in this request/process might have set it.
+    unset($GLOBALS['hook_config_test']);
+  }
+
   /**
    * Tests module installation.
    */
@@ -35,7 +43,7 @@ function testModuleInstallation() {
     $this->assertIdentical($config->isNew(), TRUE);
 
     // Install the test module.
-    module_enable(array('config_test'));
+    $this->enableModules(array('config_test'));
 
     // Verify that default module config exists.
     $config = config($default_config);
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php
index 4e0d8f7..de7784f 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php
@@ -7,12 +7,12 @@
 
 namespace Drupal\config\Tests;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Tests configuration overrides via $conf in settings.php.
  */
-class ConfigOverrideTest extends WebTestBase {
+class ConfigOverrideTest extends DrupalUnitTestBase {
 
   /**
    * Modules to enable.
@@ -29,6 +29,12 @@ public static function getInfo() {
     );
   }
 
+  function setUp() {
+    parent::setUp();
+
+    config_install_default_config('module', 'config_test');
+  }
+
   /**
    * Tests configuration override.
    */
diff --git a/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php
index 6b7a74f..064146c 100644
--- a/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php
+++ b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\config\Tests\Storage;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Base class for testing storage controller operations.
@@ -21,7 +21,7 @@
  * supply the necessary helper methods to interact with the raw/native storage
  * directly.
  */
-abstract class ConfigStorageTestBase extends WebTestBase {
+abstract class ConfigStorageTestBase extends DrupalUnitTestBase {
 
   /**
    * Tests storage controller CRUD operations.
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
new file mode 100644
index 0000000..4935038
--- /dev/null
+++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
@@ -0,0 +1,160 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\simpletest\DrupalUnitTestBase.
+ */
+
+namespace Drupal\simpletest;
+
+use Drupal\Core\Database\Database;
+
+/**
+ * Base test case class for Drupal unit tests.
+ *
+ * Tests extending this base class can access files and the database, but the
+ * entire environment is initially empty. Drupal runs in a minimal mocked
+ * environment, comparable to the one in the installer or update.php.
+ *
+ * The module/hook system is functional and operates on a fixed module list.
+ * Additional modules needed in a test may be loaded and added to the fixed
+ * module list.
+ *
+ * @see DrupalUnitTestBase::$modules
+ * @see DrupalUnitTestBase::enableModules()
+ */
+abstract class DrupalUnitTestBase extends UnitTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * Test classes extending this class, and any classes in the hierarchy up to
+   * this class, may specify individual lists of modules to enable by setting
+   * this property. The values of all properties in all classes in the hierarchy
+   * are merged.
+   *
+   * Unlike UnitTestBase::setUp(), any modules specified in the $modules
+   * property are automatically loaded and set as the fixed module list.
+   *
+   * Unlike WebTestBase::setUp(), the specified modules are loaded only, but not
+   * automatically installed. Modules need to be installed manually, if needed.
+   *
+   * @see DrupalUnitTestBase::enableModules()
+   * @see DrupalUnitTestBase::setUp()
+   *
+   * @var array
+   */
+  public static $modules = array();
+
+  /**
+   * Fixed module list being used by this test.
+   *
+   * @var array
+   *   An associative array containing the required data for the $fixed_list
+   *   argument of module_list().
+   *
+   * @see UnitTestBase::setUp()
+   * @see UnitTestBase::enableModules()
+   */
+  private $moduleList = array();
+
+  private $moduleFiles;
+  private $themeFiles;
+  private $themeData;
+
+  /**
+   * Sets up Drupal unit test environment.
+   *
+   * @see DrupalUnitTestBase::$modules
+   * @see DrupalUnitTestBase
+   */
+  protected function setUp() {
+    global $conf;
+
+    // Copy/prime extension file lists once to avoid filesystem scans.
+    if (!isset($this->moduleFiles)) {
+      $this->moduleFiles = state()->get('system.module.files') ?: array();
+      $this->themeFiles = state()->get('system.theme.files') ?: array();
+      $this->themeData = state()->get('system.theme.data') ?: array();
+    }
+
+    parent::setUp();
+
+    // Provide a minimal, partially mocked environment for unit tests.
+    $conf['lock_backend'] = 'Drupal\Core\Lock\NullLockBackend';
+    $conf['cache_classes'] = array('cache' => 'Drupal\Core\Cache\MemoryBackend');
+    $this->container
+      ->register('config.storage', 'Drupal\Core\Config\FileStorage')
+      ->addArgument($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
+    $this->container
+      ->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory')
+      ->addArgument('Drupal\Core\KeyValueStore\MemoryStorage');
+
+    state()->set('system.module.files', $this->moduleFiles);
+    state()->set('system.theme.files', $this->themeFiles);
+    state()->set('system.theme.data', $this->themeData);
+
+    // Ensure that the module list is initially empty.
+    $this->moduleList = array();
+    // Collect and set a fixed module list.
+    $class = get_class($this);
+    $modules = array();
+    while ($class) {
+      if (property_exists($class, 'modules')) {
+        $modules = array_merge($modules, $class::$modules);
+      }
+      $class = get_parent_class($class);
+    }
+    $this->enableModules($modules, FALSE);
+  }
+
+  /**
+   * Installs a specific table from a module schema definition.
+   *
+   * @param string $module
+   *   The name of the module that defines the table's schema.
+   * @param string $table
+   *   The name of the table to install.
+   */
+  protected function installSchema($module, $table) {
+    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$module.install";
+    $function = $module . '_schema';
+    $schema = $function();
+    Database::getConnection()->schema()->createTable($table, $schema[$table]);
+  }
+
+  /**
+   * Enables modules for this test.
+   *
+   * Callbacks invoked by module_enable() may need to access information
+   * provided by info hooks of the new modules already. However, module_enable()
+   * enables the new modules in the system.module configuration only, but that
+   * has no effect, since we are operating with a fixed module list.
+   *
+   * @param array $modules
+   *   A list of modules to enable.
+   * @param bool $install
+   *   (optional) Whether to install the list of modules via module_enable().
+   *   Defaults to TRUE. If FALSE, the new modules are only added to the fixed
+   *   module list and loaded.
+   *
+   * @todo Remove this method as soon as there is an Extensions service
+   *   implementation that is able to manage a fixed module list.
+   */
+  protected function enableModules(array $modules, $install = TRUE) {
+    // Set the modules in the fixed module_list().
+    foreach ($modules as $module) {
+      $this->moduleList[$module]['filename'] = drupal_get_filename('module', $module);
+    }
+    module_list(NULL, $this->moduleList);
+
+    // Call module_enable() to enable (install) the new modules.
+    if ($install) {
+      module_enable($modules);
+    }
+    // Otherwise, only ensure that the new modules are loaded.
+    else {
+      module_load_all(FALSE, TRUE);
+    }
+  }
+}
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index b31d8a0..424507b 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -791,22 +791,23 @@ protected function prepareEnvironment() {
     // a test-prefix-specific directory within the public files directory.
     // @see config_get_config_directory()
     $GLOBALS['config_directories'] = array();
-    foreach (array(CONFIG_ACTIVE_DIRECTORY, CONFIG_STAGING_DIRECTORY) as $type) {
-      $GLOBALS['config_directories'][$type]['path'] = 'simpletest/' . substr($this->databasePrefix, 10) . '/config_' . $type;
-    }
-
-    // Reset and create a new service container.
-    $this->container = drupal_container(NULL, TRUE);
-
     $this->configDirectories = array();
     include_once DRUPAL_ROOT . '/core/includes/install.inc';
-    foreach ($GLOBALS['config_directories'] as $type => $directory) {
+    foreach (array(CONFIG_ACTIVE_DIRECTORY, CONFIG_STAGING_DIRECTORY) as $type) {
+      // Assign the relative path to the global variable.
+      $path = 'simpletest/' . substr($this->databasePrefix, 10) . '/config_' . $type;
+      $GLOBALS['config_directories'][$type]['path'] = $path;
+      // Ensure the directory can be created and is writeable.
       if (!install_ensure_config_directory($type)) {
         return FALSE;
       }
-      $this->configDirectories[$type] = $this->originalFileDirectory . '/' . $directory['path'];
+      // Provide the already resolved path for tests.
+      $this->configDirectories[$type] = $this->originalFileDirectory . '/' . $path;
     }
 
+    // Reset and create a new service container.
+    $this->container = drupal_container(NULL, TRUE);
+
     // Unset globals.
     unset($GLOBALS['theme_key']);
     unset($GLOBALS['theme']);
@@ -871,6 +872,24 @@ protected function tearDown() {
     global $user, $conf;
     $language_interface = language(LANGUAGE_TYPE_INTERFACE);
 
+    // Ensure that TestBase::changeDatabasePrefix() has run and TestBase::$setup
+    // was not tricked into TRUE, since the following code would delete the
+    // entire parent site otherwise.
+    if ($this->setupDatabasePrefix) {
+      // Remove all prefixed tables.
+      $connection_info = Database::getConnectionInfo('default');
+      $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');
+      $prefix_length = strlen($connection_info['default']['prefix']['default']);
+      foreach ($tables as $table) {
+        if (db_drop_table(substr($table, $prefix_length))) {
+          unset($tables[$table]);
+        }
+      }
+      if (!empty($tables)) {
+        $this->fail('Failed to drop all prefixed tables.');
+      }
+    }
+
     // In case a fatal error occurred that was not in the test process read the
     // log to pick up any fatal errors.
     simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE);
@@ -931,6 +950,7 @@ protected function tearDown() {
    */
   public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
     if ($severity & error_reporting()) {
+      require_once DRUPAL_ROOT . '/core/includes/errors.inc';
       $error_map = array(
         E_STRICT => 'Run-time notice',
         E_WARNING => 'Warning',
@@ -944,6 +964,14 @@ public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
       );
 
       $backtrace = debug_backtrace();
+
+      // Add verbose backtrace for errors, but not for debug() messages.
+      if ($severity !== E_USER_NOTICE) {
+        $verbose_backtrace = $backtrace;
+        array_shift($verbose_backtrace);
+        $message .= '<pre class="backtrace">' . format_backtrace($verbose_backtrace) . '</pre>';
+      }
+
       $this->error($message, $error_map[$severity], _drupal_get_last_caller($backtrace));
     }
     return TRUE;
@@ -955,15 +983,19 @@ public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
    * @see set_exception_handler
    */
   protected function exceptionHandler($exception) {
+    require_once DRUPAL_ROOT . '/core/includes/errors.inc';
     $backtrace = $exception->getTrace();
+    $verbose_backtrace = $backtrace;
     // Push on top of the backtrace the call that generated the exception.
     array_unshift($backtrace, array(
       'line' => $exception->getLine(),
       'file' => $exception->getFile(),
     ));
-    require_once DRUPAL_ROOT . '/core/includes/errors.inc';
     // The exception message is run through check_plain() by _drupal_decode_exception().
-    $this->error(t('%type: !message in %function (line %line of %file).', _drupal_decode_exception($exception)), 'Uncaught exception', _drupal_get_last_caller($backtrace));
+    $message = format_string('%type: !message in %function (line %line of %file). <pre class="backtrace">!backtrace</pre>', _drupal_decode_exception($exception) + array(
+      '!backtrace' => format_backtrace($verbose_backtrace),
+    ));
+    $this->error($message, 'Uncaught exception', _drupal_get_last_caller($backtrace));
   }
 
   /**
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
index 98ed71d..506fed2 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php
@@ -11,7 +11,7 @@
 use Drupal\Core\Database\ConnectionNotDefinedException;
 
 /**
- * Test case for Drupal unit tests.
+ * Base test case class for unit tests.
  *
  * These tests can not access the database nor files. Calling any Drupal
  * function that needs the database will throw exceptions. These include
@@ -46,7 +46,6 @@ protected function setUp() {
     if (!$this->setupEnvironment) {
       return FALSE;
     }
-    $this->originalThemeRegistry = theme_get_registry(FALSE);
 
     // Reset all statics and variables to perform tests in a clean environment.
     $conf = array();
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 8ad58ef..ec800d4 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -771,32 +771,10 @@ protected function refreshVariables() {
    * and reset the database prefix.
    */
   protected function tearDown() {
-    // Ensure that TestBase::changeDatabasePrefix() has run and TestBase::$setup
-    // was not tricked into TRUE, since the following code would delete the
-    // entire parent site otherwise.
-    if (!$this->setupDatabasePrefix) {
-      return FALSE;
-    }
     // Destroy the testing kernel.
     if (isset($this->kernel)) {
       $this->kernel->shutdown();
     }
-    // Remove all prefixed tables.
-    $connection_info = Database::getConnectionInfo('default');
-    $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');
-    if (empty($tables)) {
-      $this->fail('Failed to find test tables to drop.');
-    }
-    $prefix_length = strlen($connection_info['default']['prefix']['default']);
-    foreach ($tables as $table) {
-      if (db_drop_table(substr($table, $prefix_length))) {
-        unset($tables[$table]);
-      }
-    }
-    if (!empty($tables)) {
-      $this->fail('Failed to drop all prefixed tables.');
-    }
-
     parent::tearDown();
 
     // Ensure that internal logged in variable and cURL options are reset.
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 255c669..7560694 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2821,8 +2821,8 @@ function system_rebuild_module_data() {
     $files = array();
     ksort($modules);
     // Add name, status, weight, and schema version.
-    $enabled_modules = config('system.module')->get('enabled');
-    $disabled_modules = config('system.module.disabled')->get();
+    $enabled_modules = (array) config('system.module')->get('enabled');
+    $disabled_modules = (array) config('system.module.disabled')->get();
     $all_modules = $enabled_modules + $disabled_modules;
     foreach ($modules as $module => $record) {
       $record->name = $module;
@@ -2994,7 +2994,7 @@ function system_rebuild_theme_data() {
   //   based on the current config. Remove this code when themes have a proper
   //   installation status.
   // @see http://drupal.org/node/1067408
-  $enabled_themes = config('system.theme')->get('enabled');
+  $enabled_themes = (array) config('system.theme')->get('enabled');
   $files = array();
   foreach ($themes as $name => $theme) {
     $theme->status = (int) isset($enabled_themes[$name]);
