diff --git a/core/lib/Drupal/Core/DependencyInjection/Container.php b/core/lib/Drupal/Core/DependencyInjection/Container.php
index 4e28d54..494b11c 100644
--- a/core/lib/Drupal/Core/DependencyInjection/Container.php
+++ b/core/lib/Drupal/Core/DependencyInjection/Container.php
@@ -1,29 +1,393 @@
 <?php
-
 /**
  * @file
- * Contains \Drupal\Core\DependencyInjection\Container.
+ * Contains \Drupal\Core\DependencyInjection\Container
  */
 
 namespace Drupal\Core\DependencyInjection;
 
-use Symfony\Component\DependencyInjection\Container as SymfonyContainer;
+use ReflectionClass;
+use RuntimeException;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
+use Symfony\Component\DependencyInjection\ScopeInterface;
+use Symfony\Component\DependencyInjection\Exception\LogicException;
+use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
 
 /**
- * Extends the symfony container to set the service ID on the created object.
+ * Container is a DI container that provides services to users of the class.
+ *
+ * @ingroup dic
  */
-class Container extends SymfonyContainer {
+class Container implements IntrospectableContainerInterface {
+
+  /**
+   * The parameters of the container.
+   *
+   * @var array
+   */
+  protected $parameters = array();
+
+  /**
+   * The service definitions of the container.
+   *
+   * @var array
+   */
+  protected $serviceDefinitions = array();
+
+  /**
+   * The instantiated services.
+   *
+   * @var array
+   */
+  protected $services = array();
+
+  /**
+   * The currently loading services.
+   *
+   * @var array
+   */
+  protected $loading = array();
+
+  /**
+   * Can the container parameters still be changed.
+   *
+   * For testing purposes the container needs to be changed.
+   *
+   * @var bool
+   */
+  protected $frozen = TRUE;
+
+  /**
+   * Constructs a new Container instance.
+   *
+   * @param array $container_definition
+   *   An array containing the 'services' and 'parameters'
+   * @param bool $frozen
+   *   (optional) Determines whether the container parameters can be changed,
+   *   defaults to TRUE;
+   */
+  public function __construct(array $container_definition = [], $frozen = TRUE) {
+    $container_definition += [
+      'parameters' => [],
+      'services' => [],
+    ];
+    $this->parameters = $container_definition['parameters'];
+    $this->serviceDefinitions = $container_definition['services'];
+    $this->services['service_container'] = $this;
+    $this->frozen = $frozen;
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function set($id, $service, $scope = SymfonyContainer::SCOPE_CONTAINER) {
-     parent::set($id, $service, $scope);
+  public function get($name, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+    if (isset($this->services[$name]) || ($invalidBehavior === ContainerInterface::NULL_ON_INVALID_REFERENCE && array_key_exists($name, $this->services))) {
+      return $this->services[$name];
+    }
+
+    if (isset($this->loading[$name])) {
+      throw new RuntimeException(sprintf('Circular reference detected for service "%s", path: "%s".', $name, implode(' -> ', array_keys($this->loading))));
+    }
+
+    $definition = isset($this->serviceDefinitions[$name]) ? $this->serviceDefinitions[$name] : NULL;
+
+    if (!$definition && $invalidBehavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+      throw new RuntimeException(sprintf('The "%s" service definition does not exist.', $name));
+    }
+
+    if (!$definition) {
+      $this->services[$name] = NULL;
+      return $this->services[$name];
+    }
 
-    // Ensure that the _serviceId property is set on synthetic services as well.
-    if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
-      $this->services[$id]->_serviceId = $id;
+    if (isset($definition['alias'])) {
+      return $this->get($definition['alias'], $invalidBehavior);
     }
+
+    $this->loading[$name] = TRUE;
+
+    $definition += array(
+      'class' => '',
+      'factory' => '',
+      'factory_class' => '',
+      'factory_method' => '',
+      'factory_service' => '',
+      'arguments' => array(),
+      'properties' => array(),
+      'calls' => array(),
+      'tags' => array(),
+    ); // @codeCoverageIgnore
+
+    try {
+      if (!empty($definition['arguments'])) {
+        $arguments = $this->expandArguments($definition['arguments'], $invalidBehavior);
+      } else {
+        $arguments = array();
+      }
+      if (!empty($definition['factory'])) {
+        $factory = $definition['factory'];
+        if (is_array($factory)) {
+          $factory = $this->expandArguments($factory, $invalidBehavior);
+        }
+        $service = call_user_func_array($factory, $arguments);
+      }
+      elseif (!empty($definition['factory_method'])) {
+        $method = $definition['factory_method'];
+
+        if (!empty($definition['factory_class'])) {
+          $factory = $definition['factory_class'];
+        }
+        elseif (!empty($definition['factory_service'])) {
+          $factory = $this->get($definition['factory_service'], $invalidBehavior);
+        }
+        else {
+          throw new RuntimeException(sprintf('Cannot create service "%s" from factory method without a factory service or factory class.', $name));
+        }
+        $service = call_user_func_array(array($factory, $method), $arguments);
+      }
+      else {
+        // @todo Allow dynamic class definitions via parameters.
+        $class = $definition['class'];
+        $length = count($arguments);
+
+        switch ($length) {
+          case 0:
+            $service = new $class();
+            break;
+          case 1:
+            $service = new $class($arguments[0]);
+            break;
+          case 2:
+            $service = new $class($arguments[0], $arguments[1]);
+            break;
+          case 3:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2]);
+            break;
+          case 4:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3]);
+            break;
+          case 5:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4]);
+            break;
+          case 6:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5]);
+            break;
+          case 7:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6]);
+            break;
+          case 8:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6], $arguments[7]);
+            break;
+          case 9:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6], $arguments[7], $arguments[8]);
+            break;
+          case 10:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6], $arguments[7], $arguments[8], $arguments[9]);
+            break;
+          default:
+            $r = new ReflectionClass($class);
+            $service = $r->newInstanceArgs($arguments);
+            break;
+        }
+      }
+    }
+    catch (\Exception $e) {
+      unset($this->loading[$name]);
+      throw $e;
+    }
+    $this->services[$name] = $service;
+    unset($this->loading[$name]);
+
+    foreach ($definition['calls'] as $call) {
+      $method = $call[0];
+      $arguments = array();
+      if (!empty($call[1])) {
+        $arguments = $this->expandArguments($call[1], $invalidBehavior);
+      }
+      call_user_func_array(array($service, $method), $arguments);
+    }
+    foreach ($definition['properties'] as $key => $value) {
+      $service->{$key} = $value;
+    }
+    if (isset($definition['configurator'])) {
+      $configurator = $definition['configurator'];
+      if (is_array($configurator)) {
+        $configurator = $this->expandArguments($configurator);
+      }
+
+      $method = $configurator[1];
+      $arguments = array();
+      if (!empty($configurator[0])) {
+        $arguments = [ $configurator[0] ];
+      }
+
+      call_user_func_array(array($service, $method), $arguments);
+    }
+
+    return $this->services[$name];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function set($id, $service, $scope = self::SCOPE_CONTAINER) {
+    if (isset($service)) {
+      $service->_serviceId = $id;
+    }
+    $this->services[$id] = $service;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function has($id) {
+    return isset($this->services[$id]) || isset($this->serviceDefinitions[$id]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getParameter($name) {
+    if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
+      throw new InvalidArgumentException(sprintf('You have requested a non-existent parameter "%s".', $name));
+    }
+
+    return $this->parameters[$name];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function hasParameter($name) {
+    return isset($this->parameters[$name]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setParameter($name, $value) {
+    if ($this->frozen) {
+      throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
+    }
+
+    $this->parameters[$name] = $value;
+  }
+
+  /**
+   * Expands arguments from %parameter and @service to the resolved values.
+   *
+   * @param array $arguments
+   *   The arguments to expand.
+   * @param int $invalidBehavior
+   *   The behavior when the service does not exist
+   *
+   * @return array
+   *   The expanded arguments.
+   *
+   * @throws \RuntimeException if a parameter/service could not be resolved.
+   */
+  protected function expandArguments($arguments, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+    foreach ($arguments as $key => $argument) {
+      if ($argument instanceof \stdClass) {
+        $name = $argument->id;
+        $this->serviceDefinitions[$name] = $argument->value;
+        $arguments[$key] = $this->get($name, $invalidBehavior);
+        unset($this->serviceDefinitions[$name]);
+        unset($this->services[$name]);
+        continue;
+      }
+
+      if (is_array($argument)) {
+        $arguments[$key] = $this->expandArguments($argument, $invalidBehavior);
+        continue;
+      }
+
+      if (!is_string($argument)) {
+        continue;
+      }
+
+      if (strpos($argument, '%') === 0) {
+        $name = substr($argument, 1, -1);
+        if (!isset($this->parameters[$name])) {
+          if ($invalidBehavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+            throw new RuntimeException("Could not find parameter: $name");
+          }
+          $arguments[$key] = NULL;
+          continue;
+        }
+        $arguments[$key] = $this->parameters[$name];
+      }
+      else if (strpos($argument, '@') === 0) {
+        $name = substr($argument, 1);
+        if (strpos($name, '?') === 0) {
+          $name = substr($name, 1);
+          $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
+        }
+        if (!isset($this->serviceDefinitions[$name])) {
+          if ($invalidBehavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+            throw new RuntimeException("Could not find service: $name");
+          }
+          $arguments[$key] = NULL;
+          continue;
+        }
+        $arguments[$key] = $this->get($name, $invalidBehavior);
+      }
+    }
+
+    return $arguments;
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function enterScope($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function leaveScope($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function addScope(ScopeInterface $scope) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function hasScope($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function isScopeActive($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function initialized($id) {
+    return isset($this->services[$id]);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php b/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
new file mode 100644
index 0000000..b44b6c5
--- /dev/null
+++ b/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
@@ -0,0 +1,344 @@
+<?php
+
+/*
+ * @file
+ * Contains \Drupal\Core\DependencyInjection\Dumper
+ */
+
+namespace Drupal\Core\DependencyInjection\Dumper;
+
+use Symfony\Component\DependencyInjection\Alias;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Parameter;
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\Exception\RuntimeException;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Dumper\Dumper;
+use Symfony\Component\ExpressionLanguage\Expression;
+
+/**
+ * PhpArrayDumper dumps a service container as a serialized PHP array.
+ */
+class PhpArrayDumper extends Dumper
+{
+  /**
+   * {@inheritdoc}
+   */
+  public function dump(array $options = array())
+  {
+    return serialize($this->getArray());
+  }
+
+  /**
+   * Returns the service container as a PHP array.
+   *
+   * @return array
+   *  A PHP array represention of the service container
+   */
+  public function getArray()
+  {
+    $definition = [];
+    $definition['parameters'] = $this->getParameters();
+    $definition['services'] = $this->getServiceDefinitions();
+    return $definition;
+  }
+
+
+  /**
+   * Returns parameters of the container as a PHP Array.
+   *
+   * @return array
+   *   The escaped and prepared parameters of the container.
+   */
+  protected function getParameters()
+  {
+    if (!$this->container->getParameterBag()->all()) {
+      return [];
+    }
+
+    $parameters = $this->container->getParameterBag()->all();
+    $is_frozen = $this->container->isFrozen();
+    return $this->prepareParameters($parameters, $is_frozen);
+  }
+
+  /**
+   * Returns services of the container as a PHP Array.
+   *
+   * @return array
+   *   The service definitions.
+   */
+  protected function getServiceDefinitions()
+  {
+    if (!$this->container->getDefinitions()) {
+      return [];
+    }
+
+    $services = [];
+    foreach ($this->container->getDefinitions() as $id => $definition) {
+      $services[$id] = $this->getServiceDefinition($definition);
+    }
+
+    $aliases = $this->container->getAliases();
+    foreach ($aliases as $alias => $id) {
+      while (isset($aliases[(string) $id])) {
+        $id = $aliases[(string) $id];
+      }
+      $services[$alias] = $this->getServiceAliasDefinition($id);
+    }
+
+    return $services;
+  }
+
+  /**
+   * Prepares parameters.
+   *
+   * @param array $parameters
+   * @param bool  $escape
+   *
+   * @return array
+   */
+  protected function prepareParameters($parameters, $escape = true)
+  {
+    $filtered = array();
+    foreach ($parameters as $key => $value) {
+      if (is_array($value)) {
+        $value = $this->prepareParameters($value, $escape);
+      }
+      elseif ($value instanceof Reference) {
+        $value = '@'.$value;
+      }
+
+      $filtered[$key] = $value;
+    }
+
+    return $escape ? $this->escape($filtered) : $filtered;
+  }
+
+  /**
+   * Escapes arguments.
+   *
+   * @param array $arguments
+   *   The arguments to escape.
+   *
+   * @return array
+   *   The escaped arguments.
+   */
+  protected function escape($arguments)
+  {
+    $args = array();
+    foreach ($arguments as $k => $v) {
+      if (is_array($v)) {
+        $args[$k] = $this->escape($v);
+      }
+      elseif (is_string($v)) {
+        $args[$k] = str_replace('%', '%%', $v);
+      }
+      else {
+        $args[$k] = $v;
+      }
+    }
+
+    return $args;
+  }
+
+  /**
+   * Gets a service definition as PHP array.
+   *
+   * @param \Symfony\Component\DependencyInjection\Definition $definition
+   *   The definition to process.
+   *
+   * @return array
+   *   The service definition as PHP array.
+   */
+  protected function getServiceDefinition($definition)
+  {
+    $service = [];
+    if ($definition->getClass()) {
+      $service['class'] = $definition->getClass();
+    }
+
+    if (!$definition->isPublic()) {
+      $service['public'] = FALSE;
+    }
+
+    if ($definition->getFile()) {
+      $service['file'] = $definition->getFile();
+    }
+
+    if ($definition->isSynthetic()) {
+      $service['synthetic'] = TRUE;
+    }
+
+    if ($definition->isLazy()) {
+      $service['lazy'] = TRUE;
+    }
+
+    if ($definition->getArguments()) {
+      $service['arguments'] = $this->dumpValue($definition->getArguments());
+    }
+
+    if ($definition->getProperties()) {
+      $service['properties'] = $this->dumpValue($definition->getProperties());
+    }
+
+    if ($definition->getMethodCalls()) {
+      $service['calls'] = $this->dumpValue($definition->getMethodCalls());
+    }
+
+    if (($scope = $definition->getScope()) !== ContainerInterface::SCOPE_CONTAINER) {
+      $service['scope'] = $scope;
+    }
+
+    if (($decorated = $definition->getDecoratedService()) !== NULL) {
+      $service['decorates'] = $decorated;
+    }
+
+    if ($callable = $definition->getFactory()) {
+      $service['factory'] = $this->dumpCallable($callable);
+    }
+
+    if ($callable = $definition->getConfigurator()) {
+      $service['configurator'] = $this->dumpCallable($callable);
+    }
+
+    return $service;
+  }
+
+  /**
+   * Returns a service alias definiton.
+   *
+   * @param string $alias
+   * @param Alias  $id
+   *
+   * @return string
+   */
+  protected function getServiceAliasDefinition($id)
+  {
+    if ($id->isPublic()) {
+      return [
+        'alias' => (string) $id,
+      ];
+    } else {
+      return [
+        'alias' => (string) $id,
+        'public' => FALSE,
+      ];
+    }
+  }
+  /**
+   * Dumps callable to YAML format
+   *
+   * @param callable $callable
+   *
+   * @return callable
+   */
+  protected function dumpCallable($callable)
+  {
+    if (is_array($callable)) {
+      if ($callable[0] instanceof Reference) {
+        $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]);
+      }
+      elseif ($callable[0] instanceof Definition) {
+        $callable[0] = $this->getPrivateService($callable[0]);
+        $callable = array($callable[0], $callable[1]);
+      }
+      else {
+        $callable = array($callable[0], $callable[1]);
+      }
+    }
+
+    return $callable;
+  }
+
+  /**
+   * Returns a private service definition in a suitable format.
+   *
+   * @param \Symfony\Component\DependencyInjection\Definition $definition
+   *   The definition to process.
+   *
+   * @return \stdClass
+   *   A very lightweight private service value object.
+   */
+  protected function getPrivateService(Definition $definition) {
+    $service_definition = $this->getServiceDefinition($definition);
+    $hash = sha1(serialize($service_definition));
+    return (object) [
+      'type' => 'service',
+      'id' => 'private__' . $hash,
+      'value' => $service_definition,
+    ];
+  }
+
+  /**
+   * Dumps the value to YAML format.
+   *
+   * @param mixed $value
+   *
+   * @return mixed
+   *
+   * @throws RuntimeException When trying to dump object or resource
+   */
+  protected function dumpValue($value)
+  {
+    if (is_array($value)) {
+      $code = array();
+      foreach ($value as $k => $v) {
+        $code[$k] = $this->dumpValue($v);
+      }
+
+      return $code;
+    } elseif ($value instanceof Reference) {
+      return $this->getServiceCall((string) $value, $value);
+    } elseif ($value instanceof Definition) {
+      return $this->getPrivateService($value);
+    } elseif ($value instanceof Parameter) {
+      return $this->getParameterCall((string) $value);
+    } elseif ($value instanceof Expression) {
+      return $this->getExpressionCall((string) $value);
+    } elseif (is_object($value)) {
+      if (isset($value->_serviceId)) {
+        return '@' . $value->_serviceId;
+      }
+      throw new RuntimeException('Unable to dump a service container if a parameter is an object without _serviceId.');
+    } elseif (is_resource($value)) {
+      throw new RuntimeException('Unable to dump a service container if a parameter is a resource.');
+    }
+
+    return $value;
+  }
+
+  /**
+   * Gets the service call.
+   *
+   * @param string  $id
+   * @param Reference $reference
+   *
+   * @return string
+   */
+  protected function getServiceCall($id, Reference $reference = null)
+  {
+    if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
+      return sprintf('@?%s', $id);
+    }
+
+    return sprintf('@%s', $id);
+  }
+
+  /**
+   * Gets parameter call.
+   *
+   * @param string $id
+   *
+   * @return string
+   */
+  protected function getParameterCall($id)
+  {
+    return sprintf('%%%s%%', $id);
+  }
+
+  protected function getExpressionCall($expression)
+  {
+    return sprintf('@=%s', $expression);
+  }
+}
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 6a5ce77..583b83c 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -17,17 +17,16 @@
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\DependencyInjection\ServiceProviderInterface;
 use Drupal\Core\DependencyInjection\YamlFileLoader;
+use Drupal\Core\DependencyInjection\Dumper\PhpArrayDumper;
 use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\Core\File\MimeType\MimeTypeGuesser;
 use Drupal\Core\Http\TrustedHostsRequestFactory;
 use Drupal\Core\Language\Language;
 use Drupal\Core\PageCache\RequestPolicyInterface;
-use Drupal\Core\PhpStorage\PhpStorageFactory;
 use Drupal\Core\Site\Settings;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
-use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -52,6 +51,40 @@
  */
 class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
 
+  const BOOTSTRAP_CONTAINER_BASE_CLASS = '\Drupal\Core\DependencyInjection\Container';
+
+  /**
+   * Holds the default bootstrap container definition.
+   *
+   * @var array
+   */
+  protected $defaultBootstrapContainerDefinition = [
+    'parameters' => [],
+    'services' => [
+      'database' => [
+        'class' => 'Drupal\Core\Database\Connection',
+        'factory_class' => 'Drupal\Core\Database\Database',
+        'factory_method' => 'getConnection',
+        'arguments' => ['default'],
+      ],
+      'cache.container' => [
+        'class' => 'Drupal\Core\Cache\DatabaseBackend',
+        'arguments' => ['@database', '@cache_tags_provider.container', 'container'],
+      ],
+      'cache_tags_provider.container' => [
+        'class' => 'Drupal\Core\Cache\DatabaseCacheTagsChecksum',
+        'arguments' => ['@database'],
+      ],
+    ],
+  ];
+
+  /**
+   * Holds the boostrap container instance.
+   *
+   * @var \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  protected $bootstrapContainer;
+
   /**
    * Holds the container instance.
    *
@@ -97,13 +130,6 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
   protected $moduleData = array();
 
   /**
-   * PHP code storage object to use for the compiled container.
-   *
-   * @var \Drupal\Component\PhpStorage\PhpStorageInterface
-   */
-  protected $storage;
-
-  /**
    * The class loader object.
    *
    * @var \Composer\Autoload\ClassLoader
@@ -393,6 +419,9 @@ public function boot() {
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
 
+    $class = static::BOOTSTRAP_CONTAINER_BASE_CLASS;
+    $this->bootstrapContainer = new $class(Settings::get('bootstrap_container_definition', $this->defaultBootstrapContainerDefinition));
+
     // Initialize the container.
     $this->initializeContainer();
 
@@ -711,24 +740,14 @@ public function updateModules(array $module_list, array $module_filenames = arra
   }
 
   /**
-   * Returns the classname based on environment.
+   * Returns the cache key based on environment.
    *
    * @return string
-   *   The class name.
+   *   The cache key.
    */
-  protected function getClassName() {
+  protected function getCacheKey() {
     $parts = array('service_container', $this->environment, hash('crc32b', \Drupal::VERSION . Settings::get('deployment_identifier')));
-    return implode('_', $parts);
-  }
-
-  /**
-   * Returns the container class namespace based on the environment.
-   *
-   * @return string
-   *   The class name.
-   */
-  protected function getClassNamespace() {
-    return 'Drupal\\Core\\DependencyInjection\\Container\\' . $this->environment;
+    return implode(':', $parts);
   }
 
   /**
@@ -770,25 +789,30 @@ protected function initializeContainer() {
     // If the module list hasn't already been set in updateModules and we are
     // not forcing a rebuild, then try and load the container from the disk.
     if (empty($this->moduleList) && !$this->containerNeedsRebuild) {
-      $fully_qualified_class_name = '\\' . $this->getClassNamespace() . '\\' . $this->getClassName();
-
-      // First, try to load from storage.
-      if (!class_exists($fully_qualified_class_name, FALSE)) {
-        $this->storage()->load($this->getClassName() . '.php');
+      try {
+        $cache = $this->bootstrapContainer->get('cache.container')->get($this->getCacheKey());
+      } catch (\Exception $e) {
+        // Ignore exceptions thrown by the database. In case it is really not
+        // available, it will fail during container compilation.
+        $cache = FALSE;
       }
-      // If the load succeeded or the class already existed, use it.
-      if (class_exists($fully_qualified_class_name, FALSE)) {
-        $container = new $fully_qualified_class_name;
+      if ($cache) {
+        $container_definition = $cache->data;
       }
     }
 
-    if (!isset($container)) {
-      $container = $this->compileContainer();
+    if (!isset($container_definition)) {
+      $container_builder = $this->compileContainer();
+      $dumper = new PhpArrayDumper($container_builder);
+      $container_definition = $dumper->getArray();
     }
 
     // The container was rebuilt successfully.
     $this->containerNeedsRebuild = FALSE;
 
+    $class = Settings::get('container_base_class', '\Drupal\Core\DependencyInjection\Container');
+    $container = new $class($container_definition);
+
     $this->attachSynthetic($container);
 
     $this->container = $container;
@@ -813,9 +837,8 @@ protected function initializeContainer() {
     \Drupal::setContainer($this->container);
 
     // If needs dumping flag was set, dump the container.
-    $base_class = Settings::get('container_base_class', '\Drupal\Core\DependencyInjection\Container');
-    if ($this->containerNeedsDumping && !$this->dumpDrupalContainer($this->container, $base_class)) {
-      $this->container->get('logger.factory')->get('DrupalKernel')->notice('Container cannot be written to disk');
+    if ($this->containerNeedsDumping && !$this->cacheDrupalContainer($container_definition)) {
+      $this->container->get('logger.factory')->get('DrupalKernel')->notice('Container cannot be saved to cache.');
     }
 
     return $this->container;
@@ -1031,9 +1054,8 @@ public function invalidateContainer() {
       return;
     }
 
-    // Also wipe the PHP Storage caches, so that the container is rebuilt
-    // for the next request.
-    $this->storage()->deleteAll();
+    // Also remove the container definition from the cache backend.
+    $this->bootstrapContainer->get('cache.container')->deleteAll();
   }
 
   /**
@@ -1186,35 +1208,22 @@ protected function getContainerBuilder() {
   }
 
   /**
-   * Dumps the service container to PHP code in the config directory.
-   *
-   * This method is based on the dumpContainer method in the parent class, but
-   * that method is reliant on the Config component which we do not use here.
-   *
-   * @param ContainerBuilder $container
-   *   The service container.
-   * @param string $baseClass
-   *   The name of the container's base class
+   * Stores the container definition in a cache.
    *
    * @return bool
-   *   TRUE if the container was successfully dumped to disk.
+   *   TRUE if the container was successfully cached.
    */
-  protected function dumpDrupalContainer(ContainerBuilder $container, $baseClass) {
-    if (!$this->storage()->writeable()) {
-      return FALSE;
+  protected function cacheDrupalContainer($container_definition) {
+    $saved = TRUE;
+    try {
+      $this->bootstrapContainer->get('cache.container')->set($this->getCacheKey(), $container_definition);
+    }
+    catch (\Exception $e) {
+      $saved = FALSE;
     }
-    // Cache the container.
-    $dumper = new PhpDumper($container);
-    $class = $this->getClassName();
-    $namespace = $this->getClassNamespace();
-    $content = $dumper->dump([
-      'class' => $class,
-      'base_class' => $baseClass,
-      'namespace' => $namespace,
-    ]);
-    return $this->storage()->save($class . '.php', $content);
-  }
 
+    return $saved;
+  }
 
   /**
    * Gets a http kernel from the container
@@ -1226,18 +1235,6 @@ protected function getHttpKernel() {
   }
 
   /**
-   * Gets the PHP code storage object to use for the compiled container.
-   *
-   * @return \Drupal\Component\PhpStorage\PhpStorageInterface
-   */
-  protected function storage() {
-    if (!isset($this->storage)) {
-      $this->storage = PhpStorageFactory::get('service_container');
-    }
-    return $this->storage;
-  }
-
-  /**
    * Returns the active configuration storage to use during building the container.
    *
    * @return \Drupal\Core\Config\StorageInterface
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 481b031..e19aeae 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -88,6 +88,13 @@
   protected $streamWrappers = array();
 
   /**
+   * The dependency injection container builder used in the test.
+   *
+   * @var \Symfony\Component\DependencyInjection\ContainerBuilder
+   */
+  protected $containerBuilder;
+
+  /**
    * {@inheritdoc}
    */
   function __construct($test_id = NULL) {
@@ -287,18 +294,18 @@ protected function tearDown() {
    * @see \Drupal\simpletest\KernelTestBase::disableModules()
    */
   public function containerBuild(ContainerBuilder $container) {
-    // Keep the container object around for tests.
-    $this->container = $container;
+    // Keep the container builder object around for tests.
+    $this->containerBuilder = $container;
 
     // Set the default language on the minimal container.
-    $this->container->setParameter('language.default_values', $this->defaultLanguageData());
+    $container->setParameter('language.default_values', $this->defaultLanguageData());
 
     $container->register('lock', 'Drupal\Core\Lock\NullLockBackend');
     $container->register('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory');
 
     $container
       ->register('config.storage', 'Drupal\Core\Config\DatabaseStorage')
-      ->addArgument(Database::getConnection())
+      ->addArgument(new Reference('database'))
       ->addArgument('config');
 
     if ($this->strictConfigSchema) {
@@ -312,6 +319,7 @@ public function containerBuild(ContainerBuilder $container) {
     $keyvalue_options['default'] = 'keyvalue.memory';
     $container->setParameter('factory.keyvalue', $keyvalue_options);
     $container->set('keyvalue.memory', $this->keyValueFactory);
+    $container->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory')->setSynthetic(TRUE);
     if (!$container->has('keyvalue')) {
       // TestBase::setUp puts a completely empty container in
       // $this->container which is somewhat the mirror of the empty
diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
index a4424ea..8e38987 100644
--- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
+++ b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
@@ -98,9 +98,7 @@ public function testCompileDIC() {
     $kernel = $this->getTestKernel($request);
     $container = $kernel->getContainer();
     $refClass = new \ReflectionClass($container);
-    $is_compiled_container =
-      $refClass->getParentClass()->getName() == 'Drupal\Core\DependencyInjection\Container' &&
-      !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
+    $is_compiled_container = !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
     $this->assertTrue($is_compiled_container);
     // Verify that the list of modules is the same for the initial and the
     // compiled container.
@@ -113,9 +111,7 @@ public function testCompileDIC() {
       ->getContainer();
 
     $refClass = new \ReflectionClass($container);
-    $is_compiled_container =
-      $refClass->getParentClass()->getName() == 'Drupal\Core\DependencyInjection\Container' &&
-      !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
+    $is_compiled_container = !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
     $this->assertTrue($is_compiled_container);
 
     // Verify that the list of modules is the same for the initial and the
@@ -146,7 +142,7 @@ public function testCompileDIC() {
 
     $refClass = new \ReflectionClass($container);
     $is_container_builder = $refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
-    $this->assertTrue($is_container_builder, 'Container is a builder');
+    $this->assertFalse($is_container_builder, 'Container is not a builder');
 
     // Assert that the new module's bundle was registered to the new container.
     $this->assertTrue($container->has('service_provider_test_class'), 'Container has test service');
diff --git a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
index 3096310..4e9feee 100644
--- a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
+++ b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
@@ -53,19 +53,19 @@ public function testRequest() {
    * Tests that late middlewares are automatically flagged lazy.
    */
   public function testLazyLateMiddlewares() {
-    $this->assertFalse($this->container->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is not set');
 
     \Drupal::service('module_installer')->install(['page_cache']);
     $this->container = $this->kernel->rebuildContainer();
 
-    $this->assertFalse($this->container->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_middleware.page_cache')->isLazy(), 'lazy flag on http_middleware.page_cache definition is not set');
-    $this->assertTrue($this->container->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is automatically set if page_cache is enabled.');
-    $this->assertTrue($this->container->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is automatically set if page_cache is enabled.');
-    $this->assertTrue($this->container->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is automatically set if page_cache is enabled.');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.page_cache')->isLazy(), 'lazy flag on http_middleware.page_cache definition is not set');
+    $this->assertTrue($this->containerBuilder->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is automatically set if page_cache is enabled.');
+    $this->assertTrue($this->containerBuilder->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is automatically set if page_cache is enabled.');
+    $this->assertTrue($this->containerBuilder->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is automatically set if page_cache is enabled.');
   }
 
 }
diff --git a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php b/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
index 9b67692..41afb2d 100644
--- a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
+++ b/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
@@ -7,14 +7,14 @@
 
 namespace Drupal\system\Tests\ServiceProvider;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests service provider registration to the DIC.
  *
  * @group ServiceProvider
  */
-class ServiceProviderTest extends WebTestBase {
+class ServiceProviderTest extends KernelTestBase {
 
   /**
    * Modules to enable.
@@ -27,13 +27,9 @@ class ServiceProviderTest extends WebTestBase {
    * Tests that services provided by module service providers get registered to the DIC.
    */
   function testServiceProviderRegistration() {
-    $this->assertTrue(\Drupal::getContainer()->getDefinition('file.usage')->getClass() == 'Drupal\\service_provider_test\\TestFileUsage', 'Class has been changed');
+    $definition = $this->containerBuilder->getDefinition('file.usage');
+    $this->assertTrue($definition->getClass() == 'Drupal\\service_provider_test\\TestFileUsage', 'Class has been changed');
     $this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC');
-    // The event subscriber method in the test class calls drupal_set_message with
-    // a message saying it has fired. This will fire on every page request so it
-    // should show up on the front page.
-    $this->drupalGet('');
-    $this->assertText(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired');
   }
 
   /**
diff --git a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderWebTest.php b/core/modules/system/src/Tests/ServiceProvider/ServiceProviderWebTest.php
new file mode 100644
index 0000000..e743d7b
--- /dev/null
+++ b/core/modules/system/src/Tests/ServiceProvider/ServiceProviderWebTest.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Tests\ServiceProvider\ServiceProviderWebTest.
+ */
+
+namespace Drupal\system\Tests\ServiceProvider;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests service provider registration to the DIC.
+ *
+ * @group ServiceProvider
+ */
+class ServiceProviderWebTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('file', 'service_provider_test');
+
+  /**
+   * Tests that services provided by module service providers get registered to the DIC.
+   */
+  function testServiceProviderRegistrationIntegration() {
+    $this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC');
+    // The event subscriber method in the test class calls drupal_set_message with
+    // a message saying it has fired. This will fire on every page request so it
+    // should show up on the front page.
+    $this->drupalGet('');
+    $this->assertText(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired');
+  }
+
+}
diff --git a/core/modules/system/src/Tests/System/UncaughtExceptionTest.php b/core/modules/system/src/Tests/System/UncaughtExceptionTest.php
index b5a3b3d..2423d33 100644
--- a/core/modules/system/src/Tests/System/UncaughtExceptionTest.php
+++ b/core/modules/system/src/Tests/System/UncaughtExceptionTest.php
@@ -114,14 +114,7 @@ public function testErrorContainer() {
       'required' => TRUE,
     ];
     $this->writeSettings($settings);
-
-    // Need to rebuild the container, so the dumped container can be tested
-    // and not the container builder.
-    \Drupal::service('kernel')->rebuildContainer();
-
-    // Ensure that we don't use the now broken generated container on the test
-    // process.
-    \Drupal::setContainer($this->container);
+    \Drupal::service('kernel')->invalidateContainer();
 
     $this->drupalGet('');
 
@@ -150,14 +143,7 @@ public function testExceptionContainer() {
       'required' => TRUE,
     ];
     $this->writeSettings($settings);
-
-    // Need to rebuild the container, so the dumped container can be tested
-    // and not the container builder.
-    \Drupal::service('kernel')->rebuildContainer();
-
-    // Ensure that we don't use the now broken generated container on the test
-    // process.
-    \Drupal::setContainer($this->container);
+    \Drupal::service('kernel')->invalidateContainer();
 
     $this->drupalGet('');
 
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
index a2daba7..eaec496 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
@@ -8,7 +8,7 @@
 namespace Drupal\Tests\Core\Cache;
 
 use Drupal\Core\Cache\CacheTagsInvalidator;
-use Drupal\Core\DependencyInjection\Container;
+use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -48,7 +48,7 @@ public function testInvalidateTags() {
     // a fatal error.
     $non_invalidator_cache_bin = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
 
-    $container = new Container();
+    $container = new ContainerBuilder();
     $container->set('cache.invalidator_cache_bin', $invalidator_cache_bin);
     $container->set('cache.non_invalidator_cache_bin', $non_invalidator_cache_bin);
     $container->setParameter('cache_bins', array('cache.invalidator_cache_bin' => 'invalidator_cache_bin', 'cache.non_invalidator_cache_bin' => 'non_invalidator_cache_bin'));
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/PhpArray/ContainerTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/PhpArray/ContainerTest.php
new file mode 100644
index 0000000..987aacc
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/PhpArray/ContainerTest.php
@@ -0,0 +1,604 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\DependencyInjection\PhpArray\ContainerTest.
+ */
+
+namespace Drupal\Tests\Core\DependencyInjection\PhpArray;
+
+use Drupal\Core\DependencyInjection\Container;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\Exception\LogicException;
+
+/**
+ * @coversDefaultClass \Drupal\Core\DependencyInjection\Container
+ * @group dic
+ */
+class ContainerTest extends \PHPUnit_Framework_TestCase {
+
+  /**
+   * The tested container.
+   *
+   * @var \Drupal\Core\DependencyInjection\PhpArray\Container
+   */
+  protected $container;
+
+  /**
+   * The container definition used for the test.
+   *
+   * @var []
+   */
+  protected $containerDefinition;
+
+  public function setUp() {
+    $this->containerDefinition = $this->getMockContainerDefinition();
+    $this->container = new Container($this->containerDefinition);
+  }
+
+  /**
+   * Tests that Container::getParameter() works properly.
+   * @covers ::getParameter
+   */
+  public function test_getParameter() {
+    $this->assertEquals($this->containerDefinition['parameters']['some_config'], $this->container->getParameter('some_config'), 'Container parameter matches for %some_config%.');
+    $this->assertEquals($this->containerDefinition['parameters']['some_other_config'], $this->container->getParameter('some_other_config'), 'Container parameter matches for %some_other_config%.');
+  }
+
+  /**
+   * Tests that Container::hasParameter() works properly.
+   * @covers ::hasParameter
+   */
+  public function test_hasParameter() {
+    $this->assertTrue($this->container->hasParameter('some_config'), 'Container parameters include %some_config%.');
+    $this->assertFalse($this->container->hasParameter('some_config_not_exists'), 'Container parameters do not include %some_config_not_exists%.');
+  }
+
+  /**
+   * Tests that Container::setParameter() in an unfrozen case works properly.
+   *
+   * @covers ::setParameter
+   */
+  public function test_setParameter_unfrozenContainer() {
+    $this->container = new Container($this->containerDefinition, FALSE);
+    $this->container->setParameter('some_config', 'new_value');
+    $this->assertEquals('new_value', $this->container->getParameter('some_config'), 'Container parameters can be set.');
+  }
+
+  /**
+   * Tests that Container::setParameter() in a frozen case works properly.
+   *
+   * @covers ::setParameter
+   *
+   * @expectedException LogicException
+   */
+  public function test_setParameter_frozenContainer() {
+    $this->container->setParameter('some_config', 'new_value');
+  }
+
+  /**
+   * Tests that Container::get() works properly.
+   * @covers ::get
+   */
+  public function test_get() {
+    $container = $this->container->get('service_container');
+    $this->assertSame($this->container, $container, 'Container can be retrieved from itself.');
+
+    // Retrieve services of the container.
+    $other_service_class = $this->containerDefinition['services']['other.service']['class'];
+    $other_service = $this->container->get('other.service');
+    $this->assertInstanceOf($other_service_class, $other_service, 'other.service has the right class.');
+
+    $some_parameter = $this->containerDefinition['parameters']['some_config'];
+    $some_other_parameter = $this->containerDefinition['parameters']['some_other_config'];
+
+    $service = $this->container->get('service.provider');
+
+    $this->assertEquals($other_service, $service->getSomeOtherService(), '@other.service was injected via constructor.');
+    $this->assertEquals($some_parameter, $service->getSomeParameter(), '%some_config% was injected via constructor.');
+    $this->assertEquals($this->container, $service->getContainer(), 'Container was injected via setter injection.');
+    $this->assertEquals($some_other_parameter, $service->getSomeOtherParameter(), '%some_other_config% was injected via setter injection.');
+    $this->assertEquals($service->_someProperty, 'foo', 'Service has added properties.');
+  }
+
+  /**
+   * Tests that Container::set() works properly.
+   *
+   * @covers ::set
+   */
+  public function test_set() {
+    $this->assertNull($this->container->get('new_id', ContainerInterface::NULL_ON_INVALID_REFERENCE));
+    $mock_service = new MockService();
+    $this->container->set('new_id', $mock_service);
+
+    $this->assertSame($mock_service, $this->container->get('new_id'), 'A manual set service works as expected.');
+  }
+
+  /**
+   * Tests that Container::has() works properly.
+   *
+   * @covers ::has
+   */
+  public function test_has() {
+    $this->assertTrue($this->container->has('other.service'));
+    $this->assertFalse($this->container->has('another.service'));
+
+    // Set the service manually, ensure that its also respected.
+    $mock_service = new MockService();
+    $this->container->set('another.service', $mock_service);
+    $this->assertTrue($this->container->has('another.service'));
+  }
+
+  /**
+   * Tests that Container::get() for circular dependencies works properly.
+   * @expectedException \RuntimeException
+   * @covers ::get
+   */
+  public function test_get_circular() {
+    $this->container->get('circular_dependency');
+  }
+
+  /**
+   * Tests that Container::get() for non-existant dependencies works properly.
+   * @expectedException \RuntimeException
+   * @covers ::get
+   */
+  public function test_get_exception() {
+    $this->container->get('service_not_exists');
+  }
+
+  /**
+   * Tests that Container::get() for non-existant parameters works properly.
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_get_notFound_parameter() {
+    $service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
+    $this->assertNull($service->getSomeParameter(), 'Some parameter is NULL.');
+  }
+
+  /**
+   * Tests Container::get() with an exception due to missing parameter on the second call.
+   *
+   * @covers ::get
+   * @covers ::expandArguments
+   *
+   * @expectedException \RuntimeException
+   */
+  public function test_get_notFound_parameterWithExceptionOnSecondCall() {
+    $service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
+    $this->assertNull($service->getSomeParameter(), 'Some parameter is NULL.');
+
+    // Reset the service.
+    $this->container->set('service_parameter_not_exists', NULL);
+    $this->container->get('service_parameter_not_exists');
+  }
+
+  /**
+   * Tests that Container::get() for non-existant parameters works properly.
+   * @expectedException \RuntimeException
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_get_notFound_parameter_exception() {
+    $this->container->get('service_parameter_not_exists');
+  }
+
+  /**
+   * Tests that Container::get() for non-existent dependencies works properly.
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_get_notFound_dependency() {
+    $service = $this->container->get('service_dependency_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
+    $this->assertNull($service->getSomeOtherService(), 'Some other service is NULL.');
+  }
+
+  /**
+   * Tests that Container::get() for non-existant dependencies works properly.
+   * @expectedException \RuntimeException
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_get_notFound_dependency_exception() {
+    $this->container->get('service_dependency_not_exists');
+  }
+
+
+  /**
+   * Tests that Container::get() for non-existant dependencies works properly.
+   * @covers ::get
+   */
+  public function test_get_notFound() {
+    $this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does not throw exception.');
+  }
+
+  /**
+   * Tests multiple Container::get() calls for non-existing dependencies work.
+   *
+   * @covers ::get
+   */
+  public function test_get_notFoundMultiple() {
+    $container = new Container([
+      'parameters' => [],
+      'services' => [],
+    ]);
+
+    $this->assertNull($container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE, 'Not found service does not throw exception.'));
+    $this->assertNull($container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE, 'Not found service does not throw exception on second call.'));
+  }
+
+  /**
+   * Tests multiple Container::get() calls with exception on the second time.
+   *
+   * @covers ::get
+   *
+   * @expectedException \RuntimeException
+   */
+  public function test_get_notFoundMulitpleWithExceptionOnSecondCall() {
+    $this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE, 'Not found service does nto throw exception.'));
+    $this->container->get('service_not_exists');
+  }
+
+  /**
+   * Tests that Container::get() for aliased services works properly.
+   * @covers ::get
+   */
+  public function test_get_alias() {
+    $service = $this->container->get('service.provider');
+    $aliased_service = $this->container->get('service.provider_alias');
+    $this->assertSame($service, $aliased_service);
+  }
+
+  /**
+   * Tests that Container::get() for factories via services works properly.
+   * @covers ::get
+   */
+  public function test_get_factoryService() {
+    $factory_service = $this->container->get('factory_service');
+    $factory_service_class = $this->container->getParameter('factory_service_class');
+    $this->assertInstanceOf($factory_service_class, $factory_service);
+  }
+
+  /**
+   * Tests that Container::get() for factories via factory_class works.
+   * @covers ::get
+   */
+  public function test_get_factoryClass() {
+    $service = $this->container->get('service.provider');
+    $factory_service= $this->container->get('factory_class');
+
+    $this->assertInstanceOf(get_class($service), $factory_service);
+    $this->assertEquals('bar', $factory_service->getSomeParameter(), 'Correct parameter was passed via the factory class instantiation.');
+    $this->assertEquals($this->container, $factory_service->getContainer(), 'Container was injected via setter injection.');
+  }
+
+  /**
+   * Tests that Container::get() for wrong factories works correctly.
+   * @expectedException \RuntimeException
+   * @covers ::get
+   */
+  public function test_get_factoryWrong() {
+    $this->container->get('wrong_factory');
+  }
+
+  /**
+   * Tests Container::get() for factories via services (Symfony 2.7.0).
+   * @covers ::get
+   */
+  public function test_get_factoryServiceNew() {
+    $factory_service = $this->container->get('factory_service_new');
+    $factory_service_class = $this->container->getParameter('factory_service_class');
+    $this->assertInstanceOf($factory_service_class, $factory_service);
+  }
+
+  /**
+   * Tests that Container::get() for factories via class works (Symfony 2.7.0).
+   * @covers ::get
+   */
+  public function test_get_factoryClassNew() {
+    $service = $this->container->get('service.provider');
+    $factory_service= $this->container->get('factory_class_new');
+
+    $this->assertInstanceOf(get_class($service), $factory_service);
+    $this->assertEquals('bar', $factory_service->getSomeParameter(), 'Correct parameter was passed via the factory class instantiation.');
+    $this->assertEquals($this->container, $factory_service->getContainer(), 'Container was injected via setter injection.');
+  }
+
+
+
+  /**
+   * Tests that private services work correctly.
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_expandArguments_privateService() {
+    $service = $this->container->get('service_using_private');
+    $private_service = $service->getSomeOtherService();
+    $this->assertEquals($private_service->getSomeParameter(), 'really_private_lama', 'Private was found successfully');
+  }
+
+  /**
+   * Tests that services with an array of arguments work correctly.
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_expandArguments_array() {
+    $service = $this->container->get('service_using_array');
+    $other_service = $this->container->get('other.service');
+    $this->assertEquals($other_service, $service->getSomeOtherService(), '@other.service was injected via constructor.');
+  }
+
+  /**
+   * Tests that services that are optional work correctly.
+   * @covers ::get
+   * @covers ::expandArguments
+   */
+  public function test_expandArguments_optional() {
+    $service = $this->container->get('service_with_optional_dependency');
+    $this->assertNull($service->getSomeOtherService(), 'other service was NULL was expected.');
+  }
+
+
+  /**
+   * Tests that Container::initialized works correctly.
+   * @covers ::initialized
+   */
+  public function test_initialized() {
+    $this->assertFalse($this->container->initialized('late.service'), 'Late service is not initialized.');
+    $this->container->get('late.service');
+    $this->assertTrue($this->container->initialized('late.service'), 'Late service is initialized after it was gotten.');
+  }
+
+  /**
+   * Returns a mock container definition.
+   *
+   * @return array
+   *   Associated array with parameters and services.
+   */
+  protected function getMockContainerDefinition() {
+    $fake_service = new \stdClass();
+    $parameters = array();
+    $parameters['some_private_config'] = 'really_private_lama';
+    $parameters['some_config'] = 'foo';
+    $parameters['some_other_config'] = 'lama';
+    $parameters['factory_service_class'] = get_class($fake_service);
+
+    $services = array();
+    $services['service_container'] = array(
+      'class' => '\Drupal\service_container\DependencyInjection\Container',
+    );
+    $services['other.service'] = array(
+      // @todo Support parameter expansion for classes.
+      'class' => get_class($fake_service),
+    );
+    $services['late.service'] = array(
+      'class' => get_class($fake_service),
+    );
+    $services['service.provider'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array('@other.service', '%some_config%'),
+      'properties' => array('_someProperty' => 'foo'),
+      'calls' => array(
+        array('setContainer', array('@service_container')),
+        array('setOtherConfigParameter', array('%some_other_config%')),
+       ),
+      'priority' => 0,
+    );
+    $private_service = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array('@other.service', '%some_private_config%'),
+      'public' => FALSE,
+    );
+    $private_hash = sha1(serialize($private_service));
+
+    $services['service_using_private'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\\MockService',
+      'arguments' => array(
+        (object) array(
+          'type' => 'service',
+          'value' => $private_service,
+          'id' => 'private__' . $private_hash,
+        ),
+        '%some_config%'
+      ),
+    );
+    $services['service.provider_alias'] = array(
+      'alias' => 'service.provider',
+    );
+
+    $services['service_using_array'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array(array('@other.service'), '%some_private_config%')
+    );
+    $services['service_with_optional_dependency'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array('@?service.does_not_exist', '%some_private_config%')
+    );
+
+    $services['factory_service'] = array(
+      'class' => '\Drupal\service_container\ServiceContainer\ControllerInterface',
+      'factory_method' => 'getFactoryMethod',
+      'factory_service' => 'service.provider',
+      'arguments' => array('%factory_service_class%'),
+    );
+    $services['factory_class'] = array(
+      'class' => '\Drupal\service_container\ServiceContainer\ControllerInterface',
+      'factory_method' => 'getFactoryMethod',
+      'factory_class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array(
+        '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+        array(NULL, 'bar'),
+      ),
+      'calls' => array(
+        array('setContainer', array('@service_container')),
+      ),
+    );
+    $services['factory_service_new'] = array(
+      'class' => '\Drupal\service_container\ServiceContainer\ControllerInterface',
+      'factory' => array(
+        '@service.provider',
+        'getFactoryMethod',
+      ),
+      'arguments' => array('%factory_service_class%'),
+    );
+    $services['factory_class_new'] = array(
+      'class' => '\Drupal\service_container\ServiceContainer\ControllerInterface',
+      'factory' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService::getFactoryMethod',
+      'arguments' => array(
+        '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+        array(NULL, 'bar'),
+      ),
+      'calls' => array(
+        array('setContainer', array('@service_container')),
+      ),
+    );
+
+    $services['wrong_factory'] = array(
+      'class' => '\Drupal\service_container\ServiceContainer\ControllerInterface',
+      'factory_method' => 'getFactoryMethod',
+    );
+    $services['circular_dependency'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array('@circular_dependency'),
+    );
+    $services['service_parameter_not_exists'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array('@service.provider', '%not_exists', -1),
+    );
+    $services['service_dependency_not_exists'] = array(
+      'class' => '\Drupal\Tests\Core\DependencyInjection\PhpArray\MockService',
+      'arguments' => array('@service_not_exists', '%some_config'),
+    );
+
+    return array(
+      'parameters' => $parameters,
+      'services' => $services,
+    );
+  }
+
+}
+
+
+/**
+ * Helper class to test Container::get() method.
+ *
+ * @group dic
+ */
+class MockService {
+
+  /**
+   * @var ContainerInterface
+   */
+  protected $container;
+
+  /**
+   * @var object
+   */
+  protected $someOtherService;
+
+  /**
+   * @var string
+   */
+  protected $someParameter;
+
+  /**
+   * @var string
+   */
+  protected $someOtherParameter;
+
+  /**
+   * Constructs a MockService object.
+   *
+   * @param object $some_other_service
+   *   (optional) Another injected service.
+   * @param string $some_parameter
+   *   (optional) An injected parameter.
+   */
+  public function __construct($some_other_service = NULL, $some_parameter = NULL) {
+    if (is_array($some_other_service)) {
+      $some_other_service = $some_other_service[0];
+    }
+    $this->someOtherService = $some_other_service;
+    $this->someParameter = $some_parameter;
+  }
+
+  /**
+   * Sets the container object.
+   *
+   * @param ContainerInterface $container
+   *   The container to inject via setter injection.
+   */
+  public function setContainer(ContainerInterface $container) {
+    $this->container = $container;
+  }
+
+  /**
+   * Gets the container object.
+   *
+   * @return ContainerInterface
+   *   The internally set container.
+   */
+  public function getContainer() {
+    return $this->container;
+  }
+
+  /**
+   * Gets the someOtherService object.
+   *
+   * @return object
+   *   The injected service.
+   */
+  public function getSomeOtherService() {
+    return $this->someOtherService;
+  }
+
+  /**
+   * Gets the someParameter property.
+   *
+   * @return string
+   *   The injected parameter.
+   */
+  public function getSomeParameter() {
+    return $this->someParameter;
+  }
+
+  /**
+   * Sets the someOtherParameter property.
+   *
+   * @param string $some_other_parameter
+   *   The setter injected parameter.
+   */
+  public function setOtherConfigParameter($some_other_parameter) {
+    $this->someOtherParameter = $some_other_parameter;
+  }
+
+  /**
+   * Gets the someOtherParameter property.
+   *
+   * @return string
+   *   The injected parameter.
+   */
+  public function getSomeOtherParameter() {
+    return $this->someOtherParameter;
+  }
+
+  /**
+   * Provides a factory method to get a service.
+   *
+   * @param string $class
+   *   The class name of the class to instantiate
+   * @param array $arguments
+   *   (optional) Arguments to pass to the new class.
+   *
+   * @return object
+   *   The instantiated service object.
+   */
+  public static function getFactoryMethod($class, $arguments = array()) {
+    $r = new \ReflectionClass($class);
+    $service = ($r->getConstructor() === NULL) ? $r->newInstance() : $r->newInstanceArgs($arguments);
+
+    return $service;
+  }
+
+}
