diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index fa1335b..f0c27c6 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -675,6 +675,14 @@ function drupal_settings_initialize() {
   if (file_exists(DRUPAL_ROOT . '/' . $conf_path . '/settings.php')) {
     include_once DRUPAL_ROOT . '/' . $conf_path . '/settings.php';
   }
+
+  // If running as a SimpleTest child site, load additional per-test settings.
+  if ($test_prefix = drupal_valid_test_ua()) {
+    if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/settings/simpletest_settings.php')) {
+      include_once DRUPAL_ROOT . '/' . conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/settings/simpletest_settings.php';
+    }
+  }
+
   $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
 
   if (isset($base_url)) {
@@ -2305,14 +2313,14 @@ function _drupal_bootstrap_page_cache() {
       drupal_set_title($cache->data['title'], PASS_THROUGH);
       date_default_timezone_set(drupal_get_user_timezone());
       // If the skipping of the bootstrap hooks is not enforced, call
-      // hook_boot.
-      if (variable_get('page_cache_invoke_hooks', TRUE)) {
+      // hook_boot. Hooks cannot be invoked without database access.
+      if (!variable_get('page_cache_without_database') && variable_get('page_cache_invoke_hooks', TRUE)) {
         bootstrap_invoke_all('boot');
       }
       drupal_serve_page_from_cache($cache);
       // If the skipping of the bootstrap hooks is not enforced, call
-      // hook_exit.
-      if (variable_get('page_cache_invoke_hooks', TRUE)) {
+      // hook_exit. Hooks cannot be invoked without database access.
+      if (!variable_get('page_cache_without_database') && variable_get('page_cache_invoke_hooks', TRUE)) {
         bootstrap_invoke_all('exit');
       }
       // We are done.
diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index c736245..fddbff8 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -19,13 +19,15 @@ class DatabaseStorage extends StorageBase {
     // catch the exception and just return an empty array so the caller can
     // handle it if need be.
     $data = array();
-    try {
-      $raw = db_query('SELECT data FROM {config} WHERE name = :name', array(':name' => $this->name))->fetchField();
-      if ($raw !== FALSE) {
-        $data = $this->decode($raw);
+    if (function_exists('db_query')) {
+      try {
+        $raw = db_query('SELECT data FROM {config} WHERE name = :name', array(':name' => $this->name))->fetchField();
+        if ($raw !== FALSE) {
+          $data = $this->decode($raw);
+        }
+      }
+      catch (Exception $e) {
       }
-    }
-    catch (Exception $e) {
     }
     return $data;
   }
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 902fe6a..16c53d6 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -87,6 +87,11 @@ abstract class TestBase {
   protected $setup = FALSE;
 
   /**
+   * A directory for simpletest to write a settings file to.
+   */
+  protected $additionalSettingsDirectory;
+
+  /**
    * Constructor for Test.
    *
    * @param $test_id
@@ -653,6 +658,13 @@ abstract class TestBase {
     $this->configFileDirectory = $this->originalFileDirectory . '/' . $GLOBALS['config_directory_name'];
     file_prepare_directory($this->configFileDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
 
+    // Create and set a new directory to store a simpletest_settings.php file.
+    // The child site loads this in addition to the primary settings.php file.
+    // @see drupal_settings_initialize()
+    $this->additionalSettingsDirectory = $this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10) . '/settings';
+    file_prepare_directory($this->additionalSettingsDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+    file_save_htaccess($this->additionalSettingsDirectory);
+
     // Log fatal errors.
     ini_set('log_errors', 1);
     ini_set('error_log', $this->public_files_directory . '/error.log');
@@ -852,4 +864,36 @@ abstract class TestBase {
     }
     return $all_permutations;
   }
+
+  /**
+   * Creates simpletest_settings.php file.
+   *
+   * @param array $conf
+   *   Conf overrides to add to the simpletest_settings.php, for eaxmple:
+   *   @code
+   *     array(
+   *       'page_cache_without_database' = TRUE,
+   *     );
+   *   @endcode
+   */
+  protected function createSimpletestSettingsFile($conf = array()) {
+    include_once './core/includes/utility.inc';
+
+    $contents = <<<EOF
+<?php
+/**
+ * @file
+ * Simpletest specific configuration file.
+ *
+ */
+
+EOF;
+
+    $contents .= "\$conf += " . drupal_var_export($conf) . ";\n";
+    file_put_contents($this->additionalSettingsDirectory . '/simpletest_settings.php', $contents);
+  }
+
+  protected function deleteSimpletestSettingsFile() {
+    unlink($this->additionalSettingsDirectory . '/simpletest_settings.php');
+  }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
index 6355d54..f0bd9e1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
@@ -112,6 +112,28 @@ class PageCacheTest extends WebTestBase {
   }
 
   /**
+   * Test ability for settings.php to specify a non-database backend for the page cache.
+   */
+  function testPageCacheWithoutDatabase() {
+    $conf = array(
+      'page_cache_without_database' => TRUE,
+      'cache_backends' => array(
+        'core/modules/system/tests/modules/bootstrap_test/lib/Drupal/bootstrap_test/Cache/TestBackend.php',
+      ),
+      'cache_classes' => array(
+        'cache' => 'Drupal\Core\Cache\DatabaseBackend',
+        'page' => 'Drupal\bootstrap_test\Cache\TestBackend',
+      ),
+    );
+
+    $this->createSimpletestSettingsFile($conf);
+    $this->drupalGet('');
+    $this->assertText('Page returned by Drupal\bootstrap_test\Cache\TestBackend');
+    // Have to clean up settings file so that is does not affect other tests
+    $this->deleteSimpletestSettingsFile();
+  }
+
+  /**
    * Test page compression.
    *
    * The test should pass even if zlib.output_compression is enabled in php.ini,
diff --git a/core/modules/system/tests/modules/bootstrap_test/lib/Drupal/bootstrap_test/Cache/TestBackend.php b/core/modules/system/tests/modules/bootstrap_test/lib/Drupal/bootstrap_test/Cache/TestBackend.php
new file mode 100644
index 0000000..8812398
--- /dev/null
+++ b/core/modules/system/tests/modules/bootstrap_test/lib/Drupal/bootstrap_test/Cache/TestBackend.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\bootstrap_test\Cache\TestBackend.
+ */
+
+namespace Drupal\bootstrap_test\Cache;
+use Drupal\Core\Cache\NullBackend;
+
+/**
+ * Stub cache implementation for PageCacheTest::testPageCacheWithoutDatabase().
+ */
+class TestBackend extends NullBackend {
+
+  /**
+   * Implements Drupal\Core\Cache\CacheBackendInterface::get().
+   */
+  function get($cid) {
+    return (object) array(
+      'created' => time(),
+      'data' => array(
+        'path' => 'node',
+        'title' => 'Foo',
+        'headers' => array(),
+        'body' => 'Page returned by Drupal\bootstrap_test\Cache\TestBackend',
+      ),
+    );
+  }
+
+}
