diff --git a/core/includes/path.inc b/core/includes/path.inc
index 36556a0..07aeee5 100644
--- a/core/includes/path.inc
+++ b/core/includes/path.inc
@@ -370,7 +370,7 @@ function current_path() {
   // @todo Remove the check for whether the request service exists and the
   // fallback code below, once the path alias logic has been figured out in
   // http://drupal.org/node/1269742.
-  if (drupal_container()->has('request')) {
+  if (drupal_container()->isScopeActive('request')) {
     return drupal_container()->get('request')->attributes->get('system_path');
   }
   // If we are outside the request scope, fall back to using the path stored in
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index bb2aef8..84ecea8 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\simpletest;
 
+use Drupal\Core\DrupalKernel;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\ConnectionNotDefinedException;
 use PDO;
@@ -656,6 +657,12 @@ abstract class WebTestBase extends TestBase {
       module_enable(array($this->profile), FALSE);
     }
 
+    // Create a new DrupalKernel for testing purposes, now that all required
+    // modules have been enabled.
+    $kernel = new DrupalKernel('testing', FALSE);
+    $kernel->boot();
+    $this->kernel = $kernel;
+
     // Reset/rebuild all data structures after enabling the modules.
     $this->resetAll();
 
@@ -800,6 +807,11 @@ abstract class WebTestBase extends TestBase {
     // Rebuild caches.
     $this->refreshVariables();
 
+    // Destroy the testing kernel.
+    if (isset($this->kernel)) {
+      $this->kernel->shutdown();
+    }
+
     // Close the CURL handler.
     $this->curlClose();
   }
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 4cf5780..c76f1b3 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2200,7 +2200,7 @@ function system_add_module_assets() {
  * Implements hook_custom_theme().
  */
 function system_custom_theme() {
-  if (drupal_container()->has('request')) {
+  if (drupal_container()->isScopeActive('request')) {
     $request = drupal_container()->get('request');
     $path = $request->attributes->get('system_path');
     if (user_access('view the administration theme') && path_is_admin($path)) {
