diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 80a0c29..5cbb0d0 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -332,6 +332,7 @@ protected function initializeContainer() { $this->container->set('class_loader', $this->classLoader); // If we have a request set it back to the new container. if (isset($request)) { + $this->container->enterScope('request'); $this->container->set('request', $request); } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index dd39af3..66d84b2 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -908,12 +908,6 @@ protected function prepareEnvironment() { unset($GLOBALS['theme_key']); unset($GLOBALS['theme']); - // Add a dummy request in the container. - $request = Request::create('http://example.com/'); - // We need an IP when storing sessions. - $request->server->set('REMOTE_ADDR', '3.3.3.3'); - $this->container->set('request', $request); - // Log fatal errors. ini_set('log_errors', 1); ini_set('error_log', $this->public_files_directory . '/error.log'); @@ -975,12 +969,6 @@ protected function rebuildContainer() { // DrupalKernel replaces the container in drupal_container() with a // different object, so we need to replace the instance on this test class. $this->container = drupal_container(); - - // Add a dummy request in the container. - $request = Request::create('http://example.com/'); - // We need an IP when storing sessions. - $request->server->set('REMOTE_ADDR', '3.3.3.3'); - $this->container->set('request', $request); } /**