diff --git a/.htaccess b/.htaccess
index fd7bd29..d1e3ac4 100644
--- a/.htaccess
+++ b/.htaccess
@@ -39,6 +39,14 @@ AddEncoding gzip svgz
   php_value mbstring.http_input             pass
   php_value mbstring.http_output            pass
   php_flag mbstring.encoding_translation    off
+
+  # Assertions.
+  # By default PHP has these turned on. Production sites should turn these off.
+  # While assertions can be turned off at run time, we need to have this setting
+  # in place immediately to catch an assertions thrown before the settings file
+  # can be loaded.
+  php_value assert.active                   1
+  # To enable them, change 0 to 1. Recommended for dev sites.
 </IfModule>
 
 # Requires mod_expires to be enabled.
@@ -122,6 +130,13 @@ AddEncoding gzip svgz
   RewriteCond %{REQUEST_URI} !core
   RewriteRule ^ %1/core/%2 [L,QSA,R=301]
 
+  # Redirect test requests to their own front controller
+  RewriteCond %{HTTP_USER_AGENT} simpletest
+  RewriteCond %{REQUEST_FILENAME} !-f
+  RewriteCond %{REQUEST_FILENAME} !-d
+  RewriteCond %{REQUEST_URI} !=/favicon.ico
+  RewriteRule ^ core/modules/simpletest/index.php [L]
+
   # Pass all requests not referring directly to files in the filesystem to
   # index.php.
   RewriteCond %{REQUEST_FILENAME} !-f
@@ -137,6 +152,8 @@ AddEncoding gzip svgz
   RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
   # Allow access to test-specific PHP files:
   RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?.php$
+  # Allow access to the simpletest front end controller
+  RewriteCond %{REQUEST_URI} !/core/modules/simpletest/index.php$
   # Allow access to Statistics module's custom front controller.
   # Copy and adapt this rule to directly execute PHP files in contributed or
   # custom modules or to run another PHP application in the same directory.
diff --git a/core/lib/Drupal/Component/Fault/Assertion.php b/core/lib/Drupal/Component/Fault/Assertion.php
new file mode 100644
index 0000000..1616ac0
--- /dev/null
+++ b/core/lib/Drupal/Component/Fault/Assertion.php
@@ -0,0 +1,131 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Component\Fault\Assertion.
+ *
+ * A collection of methods to assist the assert statement.
+ */
+
+namespace Drupal\Component\Fault;
+
+use Traversable;
+
+/**
+ * Assertion.
+ *
+ * This is a static function hive for use by the assert statement on the more
+ * complicated assertions we which to make.
+ */
+class Assertion {
+  /**
+   * Test to see if a class is being constructed from the allowed scope.
+   *
+   * In Java a protected method is callable by other classes in the same
+   * package, or namespace. This assertion is meant to create the same
+   * restriction, or an even tighter one if desired.
+   *
+   * This is done for the same reason the protected keyword is used. Protected
+   * methods can be changed without fear of creating backwards compatibility
+   * headaches. This further separates the internal API from the external one.
+   *
+   * @param string $scope
+   *   The allowed scope to call the class from. If left null it is assumed
+   *   the class can only be called from the same namespace or a child.
+   * @param array $trace
+   *   Only the unit tests need to provide their own trace for testing.
+   *
+   * @return bool
+   *   Validity of the caller.
+   */
+  public static function validCaller($scope = NULL, $trace = []) {
+    if (count($trace) === 0) {
+      $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+    }
+
+    // First level is the function debug_backtrace was called from. Drop.
+    array_shift($trace);
+
+    // The second should be assert. If it isn't pitch an error.
+    if ($trace[0]['function'] !== 'assert') {
+      throw new FaultException('You must call this function from assert()');
+    }
+
+    // Now pitch it out.
+    array_shift($trace);
+
+    // Idiot Proof.
+    if (count($trace) === 0) {
+      throw new FaultException('Why are you asserting this in the global namespace???');
+    }
+
+    // Get this level.
+    $origin = array_shift($trace);
+
+    // Now to find the true origin of the call we have to traverse any
+    // override functions by the children. We'll know when we've hit the caller
+    // because the function name will change.
+    do {
+      $frame = array_shift($trace);
+    } while ($frame['function'] === $origin['function']);
+
+    // Resolve the namespace of the callee's frame.
+    $namespace = substr($origin['class'], 0, strrpos($origin['class'], '\\'));
+
+    // Be a little forgiving of devs who start the scope with a \
+    if ($scope && strpos($scope, '\\') === 0) {
+      $scope = substr($scope, 1);
+    }
+
+    // Now do the check.
+    return strpos($frame['class'], empty($scope) ? $namespace : $scope) === 0 ||
+        strpos($frame['class'] . '\\' . $frame['function'], empty($scope) ? $namespace : $scope) === 0;
+  }
+
+  /**
+   * Test a collection to insure all members belong to a class or interface.
+   *
+   * @param array|Traversable $traversable
+   *   An array or traversable object.
+   * @param string $class_name
+   *   Class or interface to check for a match - including the namespace.
+   */
+  public static function collectionOf($traversable, $class_name) {
+    if (!(is_array($traversable) || (is_object($traversable) && $traversable instanceof Traversable))) {
+      return FALSE;
+    }
+    elseif (count($traversable) === 0) {
+      return FALSE;
+    }
+
+    foreach ($traversable as $obj) {
+      if (!$obj instanceof $class_name) {
+        return FALSE;
+      }
+    }
+
+    return TRUE;
+  }
+
+  /**
+   * Test a collection to insure all members are strings or string objects
+   *
+   * @param array|Traversable $traversable
+   */
+  public static function collectionOfStrings($traversable) {
+    if (!(is_array($traversable) || (is_object($traversable) && $traversable instanceof Traversable))) {
+      return FALSE;
+    }
+    elseif (count($traversable) === 0) {
+      return FALSE;
+    }
+
+    foreach ($traversable as $obj) {
+      if (!(is_string($obj) || (is_object($obj) && method_exists($obj, '__toString')))) {
+        return FALSE;
+      }
+    }
+
+    return TRUE;
+  }
+
+}
diff --git a/core/lib/Drupal/Component/Fault/AssertionHandler.php b/core/lib/Drupal/Component/Fault/AssertionHandler.php
new file mode 100644
index 0000000..a9021d8
--- /dev/null
+++ b/core/lib/Drupal/Component/Fault/AssertionHandler.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Component\Fault\AssertionHandler.
+ */
+
+namespace Drupal\Component\Fault;
+
+/**
+ * Handler for Assert Failures.
+ */
+class AssertionHandler extends BaseFaultHandler {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct($file, $line, $code, $message, $trace, $option = NULL) {
+    if (!$message && version_compare(PHP_VERSION, '5.4.8') === -1) {
+      $message = 'Assertion description messages unavailable in PHP versions prior to 5.4.8';
+    }
+    parent::__construct($file, $line, $code, $message, $trace, $option);
+  }
+
+  /**
+   * Implements BaseFaultHandler::composeLogEntry.
+   */
+  protected function composeLogEntry() {
+    return 'Assert Failure line '
+      . $this->errorLocation['line']
+      . ' in file '
+      . $this->errorLocation['file']
+      . ' -- asserted: '
+      . $this->code
+      . ' -- comment: ' . $this->message;
+  }
+
+  /**
+   * Implements BaseFaultHandler::verboseResponse.
+   */
+  protected function verboseResponse() {
+    $this->printHtmlStart(); ?>
+
+<body>
+  <h1>Assertion Failure</h1>
+  <hr>
+  <?php if ($this->code) :
+?>
+    <p><strong>Assertion:</strong> <?php echo $this->code; ?></p>
+  <?php else :
+?>
+    <strong>WARNING:</strong> The Assert statement was passed a non-string
+    value. Whatever expression was sent to it will be evaluated regardless of
+    whether assert functions are turned on or off. In order to preserve system
+    efficiency it is imperative that you encapsulate the expression in a string
+    to be evaluated by assert rather than passing an expression to it.
+  <?php
+endif ?>
+  <p><strong>Comment: </strong><?php echo $this->message; ?></p>
+  <?php if ($this->reference['error']) :
+?>
+  <p><strong>Reference: </strong><?php echo $this->reference['error'] ?></p>
+  <?php
+endif; ?>
+  <hr>
+  <h2>Failure Location</h2>
+  <p><strong>File: </strong> <?php echo $this->errorLocation['file']; ?></p>
+  <p><strong>Line: </strong> <?php echo $this->errorLocation['line']; ?></p>
+  <?php if ($this->errorLocation['class']) :
+?>
+  <p><strong>Class: </strong>
+    <a href="<?php echo $this->reference['class']; ?>">
+      <?php echo $this->errorLocation['class']; ?>
+    </a>
+  </p>
+  <p><strong>Method: </strong>
+    <a href="<?php echo $this->reference['method']; ?>">
+      <?php echo $this->errorLocation['method']; ?>
+    </a>
+  </p>
+  <?php elseif ($this->errorLocation['method']) :
+?>
+  <p><strong>Function: </strong>
+    <a href="<?php echo $this->reference['function'] ?>">
+      <?php echo $this->errorLocation['method'] ?>
+    </a>
+  </p>
+  <?php else :
+?>
+  <p><strong>Global Scope</strong></p>
+  <?php
+endif; ?>
+  <hr>
+  <h2>Stack Trace</h2>
+  <?php if (function_exists('dump') && !isset($_SERVER['DRUPAL_FAULT_COMPONENT_IN_TEST_MODE'])) :
+?>
+  <?php dump($this->trace); ?>
+  <?php else :
+    foreach ($this->trace as &$level) {
+    unset($level['args']);
+    }
+    var_dump($this->trace);
+endif; ?>
+</body>
+</html><?php
+  }
+
+}
diff --git a/core/lib/Drupal/Component/Fault/BaseFaultHandler.php b/core/lib/Drupal/Component/Fault/BaseFaultHandler.php
new file mode 100644
index 0000000..5609c3c
--- /dev/null
+++ b/core/lib/Drupal/Component/Fault/BaseFaultHandler.php
@@ -0,0 +1,361 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Component\Fault\BaseFaultHandler.
+ */
+
+namespace Drupal\Component\Fault;
+
+/**
+ * Drupal Base Fault Handler.
+ *
+ * The term "fault" refers to any form of runtime problem, be it an error from
+ * the system or trigger_error(), an uncaught exception, or an assert failure.
+ * At present this system only deals with assert failures - it will be expanded
+ * in 8.1 to deal with errors and exceptions and replace the existing code
+ * managing those areas.
+ */
+abstract class BaseFaultHandler {
+
+  /**
+   * URI of the Drupal API.
+   */
+  const API = 'https://api.drupal.org/api/drupal/';
+
+  /**
+   * Location in the Drupal API the fault codes for this type are located.
+   */
+  const CODE_DIR = '';
+
+  /**
+   * Filesystem root for Drupal.
+   */
+  protected $root;
+
+  /**
+   * Location of the fault.
+   */
+  protected $errorLocation = [
+    'file' => '',
+    'line' => '',
+    'class' => '',
+    'method' => ''
+  ];
+
+  /**
+   * Reference information for the fault.
+   */
+  protected $reference = [
+    'error' => '',
+    'class' => '',
+    'method' => ''
+  ];
+
+  /**
+   * Fault code.
+   */
+  protected $code;
+
+  /**
+   * Fault message.
+   */
+  protected $message;
+
+  /**
+   * Fault backtrace.
+   */
+  protected $trace;
+
+  /**
+   * The verbose HTML response method.
+   */
+  abstract protected function verboseResponse();
+
+  /**
+   * The log message string for the Fault.
+   */
+  abstract protected function composeLogEntry();
+
+  /**
+   * Return a Fault Response object.
+   *
+   * The FaultSetup class does the favor of normalizing the argument order from
+   * the three possible.
+   */
+  public function __construct($file, $line, $code, $message, $trace, $option = NULL) {
+    // Remember that raising an assertion while evaluating an assertion will
+    // cause a segmentation fault in the PHP engine.  This assertion however
+    // cannot be fulfilled by a call under that circumstance UNLESS invoked
+    // by a handle function other than the one in FaultSetup.
+    assert('\\Drupal\\Component\\Fault\\Assertion::validCaller()', 'This class can only be used by other classes in the Fault Component');
+
+    // Find Drupal root from here - we don't know if DRUPAL_ROOT is defined.
+    $this->root = dirname(dirname(dirname(dirname(dirname(__DIR__)))));
+
+    // Remove the root from the error file string to reduce verbosity. There is
+    // no security advantage in doing this.
+    $this->errorLocation['file'] = substr($file, strlen($this->root));
+
+    // This maps straightforwardly.
+    $this->errorLocation['line'] = $line;
+
+    // For assertions 'code' means the PHP string of code that evaluated to
+    // 'false' and triggered the assert failure. For errors and exceptions this
+    // is an error code with an associated PHP constant such as E_ERROR.
+    $this->code = $code;
+
+    // Parse out the trace to find the class and method location of the
+    // fault and remove the section of the trace from this namespace.
+    $this->parseTrace($trace, $file, $line);
+
+    // Now break down the error message string, extracting any reference link
+    // that it might contain at its start.
+    $this->parseMessage($message);
+
+  }
+
+  /**
+   * Parse out any link at the start of the message.
+   */
+  protected function parseMessage($message) {
+
+    // First look for http which indicates the author of the fault throw has
+    // a page in mind to show explaining what's going on - this will occur for
+    // third party modules.
+    if (strpos($message, 'http') === 0) {
+      $this->reference['error'] = substr($message, 0, strpos($message, ' '));
+      $this->message = substr($message, strpos($message, ' ') + 1);
+    }
+    // API: which is shorthand for the online api reference.
+    elseif (strpos($message, 'api://') === 0) {
+      $this->reference['error'] = str_replace('api://', static::API, substr($message, 0, strpos($message, ' ')));
+      $this->message = substr($message, strpos($message, ' ') + 1);
+    }
+    // node: which is shorthand for a drupal issue node.
+    elseif (strpos($message, 'node://') === 0) {
+      $this->reference['error'] = str_replace('node://', 'http://www.drupal.org/node/', substr($message, 0, strpos($message, ' ')));
+      $this->message = substr($message, strpos($message, ' ') + 1);
+    }
+    // At this point we presume that there is no error link to present, so pass
+    // along whatever message we got.
+    else {
+      $this->message = $message;
+    }
+  }
+
+  /**
+   * Make sure the backtrace starts from the class and method of the fault.
+   */
+  protected function parseTrace(array $trace, $file, $line) {
+
+    // Traverse the stack until we find the error point.
+    // Works with assertion, need to test for exceptions and errors.
+    while ($frame = array_shift($trace)) {
+      if (isset($frame['file']) && isset($frame['line']) && $frame['file'] === $file && $frame['line'] === $line) {
+        break;
+      }
+    }
+
+    // Now set the pointers to the class and method of the fault.
+    if (count($trace) > 0) {
+      if (isset($trace[0]['class'])) {
+        $this->errorLocation['class'] = $trace[0]['class'];
+      }
+      $this->errorLocation['method'] = $trace[0]['function'];
+    }
+
+    // Assemble the path to the API page for the class and method of the fault.
+    if ($this->errorLocation['class']) {
+      $this->reference['class'] = $this->getApiPageForClass($this->errorLocation['file'], $this->errorLocation['class']);
+      $this->reference['method'] = $this->getApiPageForMethod($this->errorLocation['file'], $this->errorLocation['class'], $this->errorLocation['method']);
+    }
+    // Or just the method.
+    else {
+      $this->reference['method'] = $this->getApiPageForFunction($file, $function);
+    }
+
+    $this->trace = $trace;
+
+  }
+
+  /**
+   * Return the Drupal API path for a class.
+   */
+  protected function getApiPageForClass($file, $class) {
+    return static::API
+      . str_replace("/", '!', $file)
+      . '/class/' . $class . '/8';
+  }
+
+  /**
+   * Return the Drupal API path for a method.
+   */
+  protected function getApiPageForMethod($file, $class, $method) {
+    return static::API
+        . str_replace("/", '!', $file)
+        . '/function/' . $class
+        . '%3A%3A' . $method . '/8';
+  }
+
+  /**
+   * Return the Drupal API path for a function.
+   */
+  protected function getApiPageForFunction($file, $function) {
+    return static::API
+      . str_replace("/", '!', $file)
+      . '/function/' . $function . '/8';
+  }
+
+  /**
+   * Resolve the fault.
+   */
+  public function resolve() {
+    $this->clearBuffers();
+    $this->log();
+
+    if ($this->isXmlHttpRequest()) {
+      $this->jsonRespond();
+    }
+    elseif (PHP_SAPI === 'cli' && !isset($_SERVER['DRUPAL_FAULT_COMPONENT_IN_TEST_MODE'])) {
+      $this->terminalRespond();
+    }
+    else {
+      $this->htmlRespond();
+    }
+  }
+
+  /**
+   * Send Fault response to a Javascript.
+   */
+  protected function jsonRespond() {
+    $this->sendHeaders('application/json; charset=utf-8');
+    echo $this->composeLogEntry();
+  }
+
+  /**
+   * Send the terminal response directly to stdout.
+   */
+  protected function terminalRespond() {
+    $stdout = fopen('php://stdout', 'w');
+    fwrite($stdout, $this->composeLogEntry());
+    fclose($stout);
+  }
+
+  /**
+   * Log the error both to the PHP engine log and to the system log.
+   */
+  protected function log() {
+    if (!isset($_SERVER['DRUPAL_FAULT_COMPONENT_IN_TEST_MODE'])) {
+      $entry = addslashes($this->composeLogEntry());
+      openlog('Drupal 8', LOG_PERROR, LOG_USER);
+      syslog(LOG_ERR, $entry);
+      closelog();
+      error_log($entry);
+    }
+  }
+
+  /**
+   * Determine if this script was requested by Javascript.
+   */
+  protected function isXmlHttpRequest() {
+    return (isset($_SERVER) && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
+  }
+
+  /**
+   * Clear and disable the output buffers if not testing.
+   */
+  protected function clearBuffers() {
+    if (!isset($_SERVER['DRUPAL_FAULT_COMPONENT_IN_TEST_MODE'])) {
+      while (@ob_get_level()) {
+        @ob_end_clean();
+      }
+    }
+  }
+
+  /**
+   * Respond to a fault encountered while processing an HTTP request for HTML.
+   */
+  protected function htmlRespond() {
+
+    $this->sendHeaders('text/html; charset=utf-8');
+
+    // PHP's error display level determines how much information we give.
+    if (ini_get('display_errors')) {
+      $this->verboseResponse();
+    }
+    else {
+      $this->quietResponse();
+    }
+  }
+
+  /**
+   * A quiet response.
+   */
+  protected function quietResponse() {
+
+      $this->printHtmlStart();
+      print <<<HTML
+<body>
+  <h1>System Error</h1>
+  <p>The system has encountered an error and the administrator has configured
+    the server not to publicly report the nature of the error, though it has
+    been logged.</p>
+</body>
+</html>
+HTML;
+  }
+
+  /**
+   * The start of an HTML response.
+   */
+  protected function printHtmlStart() {
+    echo <<<HTML
+<!DOCTYPE html>
+<html>
+<head>
+  <title>System Error</title>
+  <style>
+    body {
+      background: #046BC4;
+      background-size: 6em auto;
+      padding: 2em 2em 2em 120px;
+      font: sans-serif;
+      color: #FFF;
+    }
+    a { color: #FF0; }
+    a:visited { color: #FFF; }
+    strong {
+      display: inline-block;
+      width: 6em;
+      text-align: right;
+      padding-right: 1em;
+    }
+    pre {
+      background: #000;
+    }
+  </style>
+</head>
+HTML;
+
+  }
+
+  /**
+   * Send the correct response headers for a fault response.
+   */
+  protected function sendHeaders($type) {
+    if (headers_sent()) {
+      return;
+    }
+
+    header('Content-Type: ' . $type);
+
+    // Somewhat redundant - browsers shouldn't cache 500 class responses anyway.
+    header("Cache-Control: no-cache, must-revalidate");
+    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+
+    // Status return.
+    header($_SERVER["SERVER_PROTOCOL"] . " 503 Service Unavailable");
+
+  }
+
+}
diff --git a/core/lib/Drupal/Component/Fault/FaultException.php b/core/lib/Drupal/Component/Fault/FaultException.php
new file mode 100644
index 0000000..dd8538b
--- /dev/null
+++ b/core/lib/Drupal/Component/Fault/FaultException.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Component\Fault\FaultException.
+ */
+
+namespace Drupal\Component\Fault;
+
+/**
+ * Fault System Exception.
+ */
+class FaultException extends \Exception {}
diff --git a/core/lib/Drupal/Component/Fault/FaultSetup.php b/core/lib/Drupal/Component/Fault/FaultSetup.php
new file mode 100644
index 0000000..fd8f79a
--- /dev/null
+++ b/core/lib/Drupal/Component/Fault/FaultSetup.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Component\Fault\FaultSetup.
+ */
+
+namespace Drupal\Component\Fault;
+
+/**
+ * Fault System Setup.
+ */
+class FaultSetup {
+
+  /**
+   * Load the environment variables and configure the assertion handler.
+   *
+   * Note that you may call this function at any time to re-register the
+   * Fault System handlers.
+   */
+  public final static function start() {
+    if (assert_options(ASSERT_ACTIVE)) {
+      // Register our handler (next method).
+      assert_options(ASSERT_CALLBACK, [__CLASS__, 'handleAssert']);
+      // Now set assertions to not be converted to warning errors.
+      assert_options(ASSERT_WARNING, 0);
+      // Finally set the script to terminate on assertion failure, forcing
+      // whatever assertion failure that occured to be fixed.
+      assert_options(ASSERT_BAIL, 1);
+    }
+  }
+
+  /**
+   * Assertion Handler.
+   *
+   * @see http://www.php.net/assert
+   * @see http://www.php.net/assert_options
+   */
+  public final static function handleAssert($file, $line, $code, $message = NULL) {
+    (new AssertionHandler($file, $line, $code, $message, debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT)))
+      ->resolve();
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php
index 5541a68..c9ad3bc 100644
--- a/core/lib/Drupal/Core/Cache/Cache.php
+++ b/core/lib/Drupal/Core/Cache/Cache.php
@@ -37,7 +37,7 @@ public static function mergeContexts() {
       $cache_contexts = array_merge($cache_contexts, $contexts);
     }
     $cache_contexts = array_unique($cache_contexts);
-    \Drupal::service('cache_contexts')->validateTokens($cache_contexts);
+    assert('\\Drupal::service(\'cache_contexts\')->assertValidTokens($cache_contexts)', 'One or more invalid tokens passed.');
     sort($cache_contexts);
     return $cache_contexts;
   }
@@ -66,7 +66,7 @@ public static function mergeTags() {
       $cache_tags = array_merge($cache_tags, $tags);
     }
     $cache_tags = array_unique($cache_tags);
-    static::validateTags($cache_tags);
+    assert('count($cache_tags) === 0 || \\Drupal\\Component\\Fault\\Assertion::collectionOfStrings($cache_tags)', 'One or more invalid Cache Tags in passed array');
     sort($cache_tags);
     return $cache_tags;
   }
@@ -110,6 +110,8 @@ public static function mergeMaxAges() {
    *   An array of cache tags.
    *
    * @throws \LogicException
+   *
+   * @deprecated use assert('count($tags) === 0 || \\Drupal\\Component\\Fault\\Assertions::collectionOfStrings($tags)');
    */
   public static function validateTags(array $tags) {
     if (empty($tags)) {
diff --git a/core/lib/Drupal/Core/Cache/CacheContexts.php b/core/lib/Drupal/Core/Cache/CacheContexts.php
index bede04d..1daeeac 100644
--- a/core/lib/Drupal/Core/Cache/CacheContexts.php
+++ b/core/lib/Drupal/Core/Cache/CacheContexts.php
@@ -271,4 +271,16 @@ public function validateTokens(array $context_tokens = []) {
     }
   }
 
+  /**
+   * As above, but returns Boolean for use with the assert statement.
+   */
+  public function assertValidTokens(array $context_tokens = []) {
+    try {
+      $this->validateTokens($context_tokens);
+    } catch ( \LogicException $e) {
+      return FALSE;
+    }
+    return TRUE;
+  }
+
 }
diff --git a/core/modules/simpletest/index.php b/core/modules/simpletest/index.php
new file mode 100644
index 0000000..6fddcc8
--- /dev/null
+++ b/core/modules/simpletest/index.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * @file
+ * The PHP page that serves all test page requests on a Drupal installation.
+ *
+ * This page is created to relieve DrupalKernel of the responsibility of
+ * determining if we are in simpletest mode and the process of setting up for
+ * simpletests. We reach this index.php due to an htaccess rewrite setting
+ * that looks for the user agent "simpletest"
+ */
+
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
+use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+
+// Insure the working directory is identical to the primary index file for the
+// sake of any code that expects that to be so.
+chdir(dirname(dirname(dirname(dirname(__FILE__)))));
+
+$autoloader = require_once 'autoload.php';
+
+try {
+  $request = Request::createFromGlobals();
+  $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
+  $response = $kernel
+      ->handle($request)
+      // Handle the response object.
+      ->prepare($request)->send();
+  $kernel->terminate($request, $response);
+}
+catch (HttpExceptionInterface $e) {
+  $response = new Response($e->getMessage(), $e->getStatusCode());
+  $response->prepare($request)->send();
+}
+catch (Exception $e) {
+  $message = 'If you have just changed code (for example deployed a new module or moved an existing one) read <a href="http://drupal.org/documentation/rebuild">http://drupal.org/documentation/rebuild</a>';
+  if (Settings::get('rebuild_access', FALSE)) {
+    $rebuild_path = $GLOBALS['base_url'] . '/rebuild.php';
+    $message .= " or run the <a href=\"$rebuild_path\">rebuild script</a>";
+  }
+
+  // Set the response code manually. Otherwise, this response will default to a
+  // 200.
+  http_response_code(500);
+  print $message;
+  throw $e;
+}
diff --git a/core/modules/simpletest/src/AssertionTestingTrait.php b/core/modules/simpletest/src/AssertionTestingTrait.php
new file mode 100644
index 0000000..6e83811
--- /dev/null
+++ b/core/modules/simpletest/src/AssertionTestingTrait.php
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\simpletest\AssertionTestingTrait.
+ */
+
+namespace Drupal\simpletest;
+
+use Drupal\Tests\AssertionException;
+use Drupal\Tests\BaseAssertionTestingTrait;
+
+/**
+ * Methods for testing the internal PHP assert function in Simpletest.
+ *
+ * You will need to override the setup and teardown of Unit Tests in this manner
+ * to keep the library working correctly.
+ *
+ * @code
+ * public function setUp() {
+ *   $this->startAssertionHandling();
+ *   parent::setUp();
+ * }
+ * @endcode
+ *
+ * @code
+ * public function tearDown() {
+ *   $this->stopAssertionHandling();
+ *   $this->assertAssertionNotRaised();
+ *   parent::setUp();
+ * }
+ * @endcode
+ */
+trait AssertionTestingTrait {
+  use BaseAssertionTestingTrait;
+  /**
+   * Check if the assertions specified where raised.
+   *
+   * This function can be overloaded. Assertions should be passed in the order
+   * they are expected to occur. After being accounted for the assertion count
+   * is reset.
+   */
+  protected function assertAssertionsRaised() {
+    $this->assertIdentical(func_get_args(), $this->assertionsRaised, 'Expected Assertions Raised.');
+    $this->assertionsRaised = [];
+  }
+
+  /**
+   * Insure no assertions where thrown.
+   *
+   * Called during teardown, but you may wish to call it at other times.
+   */
+  protected function assertAssertionNotRaised() {
+    $this->assertTrue(count($this->assertionsRaised) === 0, 'No Assertions Raised');
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/AssertionException.php b/core/tests/Drupal/Tests/AssertionException.php
new file mode 100644
index 0000000..a809a04
--- /dev/null
+++ b/core/tests/Drupal/Tests/AssertionException.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * @file
+ * Contains Drupal\Tests\AssertionException.
+ */
+
+namespace Drupal\Tests;
+
+/**
+ * On occassion we need to die immediately on assertion failure.
+ *
+ * In development we die immediately on assertion failure. In most of the tests
+ * we allow the test to continue despite the failure to check to see if the code
+ * remains (relatively) stable despite the failure - this is done because assert
+ * statements, unlike conditionals, can be turned off, and we need to test code
+ * behavior in that situation.
+ *
+ * Some assertions however assert conditions that *will* bring the code to an
+ * immediate and ungraceful halt soon after the assertion if they are failed.
+ * In order to test those failures we'll need to tell the assert handler in the
+ * AssertionTestingTrait to convert the assert statement into an exception so
+ * that it can be handled by PHP Unit.
+ */
+class AssertionException extends \Exception {}
diff --git a/core/tests/Drupal/Tests/AssertionTestingTrait.php b/core/tests/Drupal/Tests/AssertionTestingTrait.php
new file mode 100644
index 0000000..e944385
--- /dev/null
+++ b/core/tests/Drupal/Tests/AssertionTestingTrait.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * @file
+ * Contains Drupal\Tests\AssertionTestingTrait.
+ */
+
+namespace Drupal\Tests;
+
+/**
+ * Methods for testing the internal PHP assert function in PHP Unit.
+ *
+ * You will need to override the construct of Drupal Unit Tests in this manner
+ * to keep the library working correctly.
+ *
+ * @code
+ * public function setUp() {
+ *   $this->startAssertionHandling();
+ *   parent::setUp();
+ * }
+ * @endcode
+ */
+trait AssertionTestingTrait {
+  use BaseAssertionTestingTrait;
+  /**
+   * {@inheritdoc}
+   *
+   * Drupal Unit test has no tear down and since this trait will most
+   * frequently be applied to its children we just go ahead and define this
+   * method.  Reminder - if you need to define this method in your test you'll
+   * need to alias this function when you bind in the trait.
+   */
+  protected function tearDown() {
+
+    $this->stopAssertionHandling();
+
+    $this->assertEmpty(
+            $this->assertionsRaised,
+            'Unaccounted for assert fails found at test conclusion: ' . implode(', ', $this->assertionsRaised)
+      );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function assertAssertionsRaised() {
+    $this->assertEquals(func_get_args(), $this->assertionsRaised);
+    $this->assertionsRaised = [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function assertAssertionNotRaised() {
+    $this->assertEmpty($this->assertionsRaised);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/BaseAssertionTestingTrait.php b/core/tests/Drupal/Tests/BaseAssertionTestingTrait.php
new file mode 100644
index 0000000..14f267e
--- /dev/null
+++ b/core/tests/Drupal/Tests/BaseAssertionTestingTrait.php
@@ -0,0 +1,131 @@
+<?php
+/**
+ * @file
+ * Contains Drupal\Tests\BaseAssertionTestingTrait.
+ */
+
+namespace Drupal\Tests;
+
+/**
+ * Methods for testing the internal PHP assert function.
+ *
+ * This class contains the methods PHP Unit and Simple Test can safely share.
+ *
+ * By default, both convert assert failures to exceptions stopping the code in
+ * its tracks.  These methods allow the tester to log the last assertion
+ * statement's message and thereby monitor when they are thrown and correct.
+ */
+trait BaseAssertionTestingTrait {
+
+  /**
+   * Flag assertion handler to throw an exception on raise, ending the test.
+   */
+  protected $dieOnRaise = FALSE;
+
+  /**
+   * Collections of captured assertions.
+   */
+  protected $assertionsRaised = [];
+
+  /**
+   * Errors Expected.
+   *
+   * This flag prevents the tearDown from checking for unaccounted assertions.
+   * after an error throw.
+   */
+  protected $thereWillBeErrors = FALSE;
+
+  /**
+   * Callback handler for assert raises during testing.
+   */
+  public function assertCallbackHandle($file, $line, $code, $message) {
+
+    // We print out this warning during test development, and since the
+    // automated tests run in strict mode it will cause a test failure.
+    if (!$code) {
+      print ('Assertions should always be strings! Even though PHP permits
+        other argument types, those arguments will be evaluated which causes
+        a loss of performance.');
+    }
+
+    // Usually we want to let the code continue evaluating as it is going to
+    // do when assertions are turned off just to make sure the code doesn't
+    // enter a fatal condition. However, some assertions are guarding against
+    // Fatal conditions anyway and there will be no way to recover from these
+    // failures. When testing these assertions, set the dieOnRaise flag which
+    // causes the exception throw here.
+    if ($this->dieOnRaise) {
+      throw new AssertionException($message);
+    }
+
+    // Otherwise we log the assertion as thrown and let the code continue.
+    // However, be aware we assert that this array is empty during tear down.
+    // If it isn't the test will fail.
+    $this->assertionsRaised[] = $message;
+
+    // Inform PHP we've successfully completed our handling of the assert fail.
+    return TRUE;
+  }
+
+  /**
+   * Start assertion handling for the test.
+   */
+  protected function startAssertionHandling() {
+
+    assert_options(ASSERT_WARNING, FALSE);
+    assert_options(ASSERT_BAIL, FALSE);
+    assert_options(ASSERT_CALLBACK, [$this, 'assertCallbackHandle']);
+    $this->assertionsRaised = [];
+    return FALSE;
+  }
+
+  /**
+   * Suspend assertion handling.
+   */
+  protected function suspendAssertionHandling() {
+
+    assert_options(ASSERT_WARNING, TRUE);
+    assert_options(ASSERT_CALLBACK, NULL);
+    $this->assertionsRaised = [];
+  }
+
+  /**
+   * Cease handling assertions and clear the way for the next test.
+   *
+   * Call this from tearDown()
+   */
+  protected function stopAssertionHandling() {
+
+    // If an error was expected and indeed thrown there will be no chance to
+    // clear out the assertion log before we reach this function, so set the
+    // flag to skip the assertions check.
+    //
+    // Only use this when testing errors that you are raising yourself with
+    // trigger error (and that itself should be rare).  In other cases go ahead
+    // and catch the assertion by setting the dieOnRaise flag.
+    if ($this->thereWillBeErrors) {
+      $this->assertionsRaised = [];
+      $this->thereWillBeErrors = FALSE;
+    }
+
+    $this->suspendAssertionHandling();
+    $this->dieOnRaise = FALSE;
+  }
+
+  /**
+   * Check if the assertions specified where raised.
+   *
+   * This function can be overloaded. Assertions should be passed in the order
+   * they are expected to occur. After being accounted for the assertion count
+   * is reset.
+   */
+  abstract protected function assertAssertionsRaised();
+
+  /**
+   * Insure no assertions where thrown.
+   *
+   * Called during teardown, but you may wish to call it at other times.
+   */
+  abstract protected function assertAssertionNotRaised();
+
+}
diff --git a/core/tests/Drupal/Tests/Component/Fault/AssertionHandlerTest.php b/core/tests/Drupal/Tests/Component/Fault/AssertionHandlerTest.php
new file mode 100644
index 0000000..35991d8
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Fault/AssertionHandlerTest.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Fault\AssertionHandlerTest.
+ */
+
+namespace Drupal\Tests\Component\Fault;
+
+use Drupal\Component\Fault\AssertionHandler;
+use Drupal\Component\Fault\FaultSetup;
+use Drupal\Tests\UnitTestCase;
+use Drupal\Tests\AssertionTestingTrait;
+
+/**
+ * @coversDefaultClass \Drupal\Component\Fault\AssertionHandler
+ * @group Fault
+ */
+class AssertionHandlerTest extends UnitTestCase {
+  use AssertionTestingTrait;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    $this->startAssertionHandling();
+    parent::setUp();
+  }
+
+  /**
+   * Test the constructor to make sure it asserts it shouldn't be called.
+   */
+  public function testConstructor() {
+    // Flag to the AssertionHandler that it is to spit out HTML anyway, leave
+    // the buffers alone, and not log anything.
+    $_SERVER['DRUPAL_FAULT_COMPONENT_IN_TEST_MODE'] = TRUE;
+
+    // JSON Response.
+    $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
+
+    $response = new AssertionHandler(__FILE__, 42, 'FALSE', 'node://66 test2', [
+      [
+        'file' => __FILE__,
+        'line' => 42,
+        'function' => 'assert',
+        'class' => 'Moo',
+      ],
+      [
+        'file' => 'check',
+        'line' => 12,
+        'function' => 'clear',
+        'class' => 'Woo'
+      ]
+    ]);
+    $this->assertAssertionsRaised('This class can only be used by other classes in the Fault Component');
+
+    ob_start();
+    $response->resolve();
+    $this->assertEquals('Assert Failure line 42 in file /core/tests/Drupal/Tests/Component/Fault/AssertionHandlerTest.php -- asserted: FALSE -- comment: test2',
+      ob_get_clean()
+    );
+
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Component/Fault/AssertionTest.php b/core/tests/Drupal/Tests/Component/Fault/AssertionTest.php
new file mode 100644
index 0000000..4242aa7
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Fault/AssertionTest.php
@@ -0,0 +1,246 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Tests\Component\Fault\AssertionTest.
+ */
+
+namespace Drupal\Tests\Component\Fault;
+
+use Drupal\Component\Fault\FaultSetup;
+use Drupal\Component\Fault\Assertion;
+use Drupal\Tests\UnitTestCase;
+use Drupal\Tests\ToStringMock;
+use ArrayObject;
+
+/**
+ * Test the static Assertion assisting Library.
+ *
+ * @coversDefaultClass \Drupal\Component\Fault\FaultSetup
+ *
+ * @group Fault
+ */
+class AssertionTest extends UnitTestCase {
+
+  /**
+   * Test that the caller throws an error if called outside the scope of assert.
+   *
+   * @expectedException \Drupal\Component\Fault\FaultException
+   *
+   * @expectedExceptionMessage You must call this function from assert()
+   */
+  public function testValidCallerExceptionFromAssert() {
+    Assertion::validCaller('', [
+      ['function' => 'foo'],
+      ['function' => 'moo']
+    ]);
+  }
+
+  /**
+   * Test the throw of an error when the assert is made outside of any function.
+   *
+   * @expectedException \Drupal\Component\Fault\FaultException
+   *
+   * @expectedExceptionMessage Why are you asserting this in the global namespace???
+   */
+  public function testValidCallerExceptionNotGlobal() {
+    Assertion::validCaller('', [
+      ['function' => 'foo'],
+      ['function' => 'assert']
+    ]);
+  }
+
+  /**
+   * Test the analysis of stackframes.
+   */
+  public function testValidCallerAnalysis() {
+    // Call in same class.
+    $this->assertTrue(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'caller', 'class' => 'A\\B\\C']
+      ])
+    );
+
+    // Call in same namespace.
+    $this->assertTrue(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'caller', 'class' => 'A\\B\\D']
+      ])
+    );
+
+    // Call in child namespace.
+    $this->assertTrue(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'caller', 'class' => 'A\\B\\D\\E']
+      ])
+    );
+
+    // Call in parent namespace.
+    $this->assertFalse(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'caller', 'class' => 'A\\D']
+      ])
+    );
+
+    // Call from global namespace.
+    $this->assertFalse(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'caller', 'class' => 'D']
+      ])
+    );
+
+    // A child class will have to be in the same namepace to function.
+    $this->assertTrue(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'callee', 'class' => 'A\\B\\D'],
+        ['function' => 'callee', 'class' => 'A\\B\\E'],
+        ['function' => 'caller', 'class' => 'A\\B\\F']
+      ])
+    );
+
+    // Or in a child namespace. The scope governance is that of the class
+    // making the assertion.
+    $this->assertTrue(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'callee', 'class' => 'A\\B\\D\\E'],
+        ['function' => 'callee', 'class' => 'A\\B\\F\\G\\E'],
+        ['function' => 'caller', 'class' => 'A\\B\\F\\G']
+      ])
+    );
+
+    // An extender class from a foreign namespace allows calls from the original
+    // namespace.
+    $this->assertTrue(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'callee', 'class' => 'A\\D\\E'],
+        ['function' => 'caller', 'class' => 'A\\B\\F\\G']
+      ])
+    );
+
+    // But will not allow calls from a new namespace.
+    $this->assertFalse(
+      Assertion::validCaller('', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'callee', 'class' => 'A\\D\\E'],
+        ['function' => 'caller', 'class' => 'A\\F\\G']
+      ])
+    );
+
+    // Test scope argument.
+    $this->assertTrue(
+      Assertion::validCaller('A\\F', [
+        ['function' => 'foo'],
+        ['function' => 'assert'],
+        ['function' => 'callee', 'class' => 'A\\B\\C'],
+        ['function' => 'callee', 'class' => 'A\\D\\E'],
+        ['function' => 'caller', 'class' => 'A\\F\\G']
+      ])
+    );
+
+  }
+
+  /**
+   * Test the collectionOf method.
+   */
+  public function testCollectionOf() {
+    // We don't need a test mock - the internal ArrayObject will work just fine.
+    $this->assertTrue(
+      Assertion::collectionOf([
+        new ArrayObject(),
+        new ArrayObject()
+      ], 'ArrayObject')
+    );
+
+    $this->assertFalse(
+      Assertion::collectionOf([
+        new ArrayObject(),
+        []
+      ], 'ArrayObject')
+    );
+
+    $this->assertTrue(
+      Assertion::collectionOf(new ArrayObject([
+        new ArrayObject(),
+        new ArrayObject()
+      ]), 'ArrayObject')
+    );
+
+    $this->assertFalse(
+      Assertion::collectionOf(new ArrayObject([
+        new ArrayObject(),
+        []
+      ]), 'ArrayObject')
+    );
+
+    // Non traversables fail.
+    $this->assertFalse(
+      Assertion::collectionOf('string', 'ArrayObject')
+    );
+
+    $this->assertFalse(
+      Assertion::collectionOf(new \stdClass(), 'ArrayObject')
+    );
+
+    // Empty collections fail.
+    $this->assertFalse(
+      Assertion::collectionOf([], 'ArrayObject')
+    );
+
+  }
+
+  /**
+   * Test CollectionOfStrings method.
+   */
+  public function testCollectionOfStrings() {
+    $this->assertTrue(Assertion::collectionOfStrings([
+      'foo',
+      'boo',
+      new ToStringMock('doo')
+    ]));
+
+    $this->assertTrue(Assertion::collectionOfStrings(new ArrayObject([
+      'foo',
+      'boo',
+      new ToStringMock('doo')
+    ])));
+
+    $this->assertFalse(Assertion::collectionOfStrings([
+      'foo',
+      1,
+      new ToStringMock('doo')
+    ]));
+
+    $this->assertFalse(Assertion::collectionOfStrings(new ArrayObject([
+      'foo',
+      1,
+      new ToStringMock('doo')
+    ])));
+
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Component/Fault/FaultSetupTest.php b/core/tests/Drupal/Tests/Component/Fault/FaultSetupTest.php
new file mode 100644
index 0000000..30aea68
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Fault/FaultSetupTest.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Tests\Component\Fault\FaultSetupTest.
+ */
+
+namespace Drupal\Tests\Component\Fault;
+
+use Drupal\Component\Fault\FaultSetup;
+use Drupal\Component\Fault\AssertionHandler;
+use Drupal\Tests\AssertionTestingTrait;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Component\Fault\FaultSetup
+ * @group Fault
+ */
+class FaultSetupTest extends UnitTestCase {
+  use AssertionTestingTrait;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    $this->startAssertionHandling();
+    parent::setUp();
+  }
+
+  /**
+   * Test the static start method.
+   */
+  public function testStart() {
+    // Assertions already on, so the method should detect this and set its
+    // handler up. It also activates assert_bail.
+    FaultSetup::start();
+    $this->assertEquals(['Drupal\\Component\\Fault\\FaultSetup', 'handleAssert'], assert_options(ASSERT_CALLBACK));
+    $this->assertEquals(1, assert_options(ASSERT_BAIL));
+
+    // Reset and disable assertions momentarily.
+    assert_options(ASSERT_CALLBACK, NULL);
+    assert_options(ASSERT_ACTIVE, 0);
+
+    // Now test to see if the method does nothing as it should when assert
+    // active = 0
+    FaultSetup::start();
+    $this->assertEquals(0, assert_options(ASSERT_ACTIVE));
+    $this->assertEquals(NULL, assert_options(ASSERT_CALLBACK));
+
+    // Restore test environment defaults.
+    assert_options(ASSERT_ACTIVE, 1);
+    assert_options(ASSERT_BAIL, 0);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
index 7f24130..5a38ed2 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
@@ -96,6 +96,7 @@ protected function setUp() {
     $this->cacheContexts = $this->getMockBuilder('Drupal\Core\Cache\CacheContexts')
       ->disableOriginalConstructor()
       ->getMock();
+    $this->cacheContexts->method('assertValidTokens')->willReturn(TRUE);
     $this->cacheContexts->expects($this->any())
       ->method('convertTokensToKeys')
       ->willReturnCallback(function($context_tokens) {
diff --git a/core/tests/Drupal/Tests/ToStringMock.php b/core/tests/Drupal/Tests/ToStringMock.php
new file mode 100644
index 0000000..eacea64
--- /dev/null
+++ b/core/tests/Drupal/Tests/ToStringMock.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @file
+ * Contains Drupal\Tests\ToStringMock.
+ */
+
+namespace Drupal\Tests;
+
+/**
+ * Simply provides an object that implements magic __toString.
+ */
+class ToStringMock {
+
+  /**
+   * String.
+   */
+  protected $string = '';
+
+  /**
+   * Return Drupal\Tests\ToStringMock object.
+   */
+  public function __construct($string) {
+    $this->string = strval($string);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __toString() {
+    return $this->string;
+  }
+
+}
diff --git a/index.php b/index.php
index a44e5c5..e4de701 100644
--- a/index.php
+++ b/index.php
@@ -10,14 +10,16 @@
 
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Site\Settings;
+use Drupal\Component\Fault\FaultSetup;
 use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 
 $autoloader = require_once 'autoload.php';
 
-try {
+FaultSetup::start();
 
+try {
   $request = Request::createFromGlobals();
   $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
   $response = $kernel
