diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponse.php b/core/lib/Drupal/Core/Ajax/AjaxResponse.php index a460f19..e5f327e 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxResponse.php +++ b/core/lib/Drupal/Core/Ajax/AjaxResponse.php @@ -57,7 +57,7 @@ public function prepare(Request $request) { } /** - * Sets the rendered ajax ajax right before the response is prepared + * Sets the rendered ajax right before the response is prepared * * @param \Symfony\Component\HttpFoundation\Request $request * The request object. diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index e2a5079..2108b67 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -975,7 +975,6 @@ protected function prepareEnvironment() { $this->container->register('info_parser', 'Drupal\Core\Extension\InfoParser'); $request = Request::create('/'); - $request->attributes->set('_account', $GLOBALS['user']); $this->container->set('request', $request); $this->container->set('current_user', $GLOBALS['user']); @@ -1041,12 +1040,16 @@ protected function prepareConfigDirectories() { * enabled modules to be immediately available in the same request. */ protected function rebuildContainer() { + // Preserve the request object after the container rebuild. + $request = \Drupal::request(); + $this->kernel = new DrupalKernel('testing', drupal_classloader(), FALSE); $this->kernel->boot(); // DrupalKernel replaces the container in \Drupal::getContainer() with a // different object, so we need to replace the instance on this test class. $this->container = \Drupal::getContainer(); // The global $user is set in TestBase::prepareEnvironment(). + $this->container->set('request', $request); $this->container->set('current_user', $GLOBALS['user']); }