diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
index e54e121..794c798 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
@@ -88,7 +88,7 @@ protected function setUp() {
 
     parent::setUp();
     // Build a minimal, partially mocked environment for unit tests.
-    $this->containerBuild(drupal_container());
+    $this->containerBuild(\Drupal::service());
     // Make sure it survives kernel rebuilds.
     $GLOBALS['conf']['container_service_providers']['TestServiceProvider'] = 'Drupal\simpletest\TestServiceProvider';
 
@@ -156,7 +156,7 @@ public function containerBuild(ContainerBuilder $container) {
     $container->set('keyvalue.memory', $this->keyValueFactory);
     if (!$container->has('keyvalue')) {
       // TestBase::setUp puts a completely empty container in
-      // drupal_container() which is somewhat the mirror of the empty
+      // \Drupal::service() which is somewhat the mirror of the empty
       // environment being set up. Unit tests need not to waste time with
       // getting a container set up for them. Drupal Unit Tests might just get
       // away with a simple container holding the absolute bare minimum. When
@@ -194,7 +194,7 @@ public function containerBuild(ContainerBuilder $container) {
    */
   protected function installConfig(array $modules) {
     foreach ($modules as $module) {
-      if (!$this->container->get('module_handler')->moduleExists($module)) {
+      if (!\Drupal::moduleHandler()->moduleExists($module)) {
         throw new \RuntimeException(format_string("'@module' module is not enabled.", array(
           '@module' => $module,
         )));
@@ -220,7 +220,7 @@ protected function installSchema($module, $tables) {
     // file depends on many other factors. To prevent differences in test
     // behavior and non-reproducible test failures, we only allow the schema of
     // explicitly loaded/enabled modules to be installed.
-    if (!$this->container->get('module_handler')->moduleExists($module)) {
+    if (!\Drupal::moduleHandler()->moduleExists($module)) {
       throw new \RuntimeException(format_string("'@module' module is not enabled.", array(
         '@module' => $module,
       )));
@@ -256,7 +256,7 @@ protected function installSchema($module, $tables) {
    */
   protected function enableModules(array $modules) {
     // Set the list of modules in the extension handler.
-    $module_handler = $this->container->get('module_handler');
+    $module_handler = \Drupal::moduleHandler();
     $module_filenames = $module_handler->getModuleList();
     foreach ($modules as $module) {
       $module_filenames[$module] = drupal_get_filename('module', $module);
@@ -269,7 +269,7 @@ protected function enableModules(array $modules) {
     // Ensure isLoaded() is TRUE in order to make theme() work.
     // Note that the kernel has rebuilt the container; this $module_handler is
     // no longer the $module_handler instance from above.
-    $module_handler = $this->container->get('module_handler');
+    $module_handler = \Drupal::moduleHandler();
     $module_handler->reload();
     $this->pass(format_string('Enabled modules: %modules.', array(
       '%modules' => implode(', ', $modules),
@@ -287,7 +287,7 @@ protected function enableModules(array $modules) {
    */
   protected function disableModules(array $modules) {
     // Unset the list of modules in the extension handler.
-    $module_handler = $this->container->get('module_handler');
+    $module_handler = \Drupal::moduleHandler();
     $module_filenames = $module_handler->getModuleList();
     foreach ($modules as $module) {
       unset($module_filenames[$module]);
@@ -300,7 +300,7 @@ protected function disableModules(array $modules) {
     // Ensure isLoaded() is TRUE in order to make theme() work.
     // Note that the kernel has rebuilt the container; this $module_handler is
     // no longer the $module_handler instance from above.
-    $module_handler = $this->container->get('module_handler');
+    $module_handler = \Drupal::moduleHandler();
     $module_handler->reload();
     $this->pass(format_string('Disabled modules: %modules.', array(
       '%modules' => implode(', ', $modules),
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 3eb5c84..28aa8f6 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -863,7 +863,7 @@ protected function prepareEnvironment() {
     $this->originalConf = $conf;
 
     // Backup statics and globals.
-    $this->originalContainer = clone drupal_container();
+    $this->originalContainer = clone \Drupal::service();
     $this->originalLanguage = $language_interface;
     $this->originalConfigDirectories = $GLOBALS['config_directories'];
     if (isset($GLOBALS['theme_key'])) {
@@ -965,7 +965,7 @@ protected function prepareConfigDirectories() {
   }
 
   /**
-   * Rebuild drupal_container().
+   * Rebuild \Drupal::service().
    *
    * Use this to build a new kernel and service container. For example, when the
    * list of enabled modules is changed via the internal browser, in which case
@@ -973,7 +973,7 @@ protected function prepareConfigDirectories() {
    * old module list.
    *
    * @todo Fix http://drupal.org/node/1708692 so that module enable/disable
-   *   changes are immediately reflected in drupal_container(). Until then,
+   *   changes are immediately reflected in :\Drupal::service(). Until then,
    *   tests can invoke this workaround when requiring services from newly
    *   enabled modules to be immediately available in the same request.
    *
@@ -983,9 +983,9 @@ protected function prepareConfigDirectories() {
   protected function rebuildContainer() {
     $this->kernel = new DrupalKernel('testing', drupal_classloader(), FALSE);
     $this->kernel->boot();
-    // DrupalKernel replaces the container in drupal_container() with a
+    // DrupalKernel replaces the container in \Drupal::service() with a
     // different object, so we need to replace the instance on this test class.
-    $this->container = drupal_container();
+    $this->container = \Drupal::service();
   }
 
   /**
@@ -1028,7 +1028,7 @@ protected function tearDown() {
     // In case a fatal error occurred that was not in the test process read the
     // log to pick up any fatal errors.
     simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE);
-    if (($container = drupal_container()) && $container->has('keyvalue')) {
+    if (($container = \Drupal::service()) && $container->has('keyvalue')) {
       $captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array();
       $emailCount = count($captured_emails);
       if ($emailCount) {
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 8e295b3..7e78830 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -934,7 +934,7 @@ protected function refreshVariables() {
     global $conf;
     cache('bootstrap')->delete('variables');
     $conf = variable_initialize();
-    drupal_container()->get('config.factory')->reset();
+    \Drupal::service()->get('config.factory')->reset();
   }
 
   /**
