diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
index 11de754..dd4c183 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
@@ -64,8 +64,11 @@ function testInternalBrowser() {
       )));
       $this->assertNoTitle('Foo');
 
+      $current_user = $this->container->get('current_user')->id();
       $user = $this->drupalCreateUser();
       $this->drupalLogin($user);
+      // Check that current user service updated.
+      $this->assertNotEqual($current_user, $this->container->get('current_user')->id(), 'Current user service updated.');
       $headers = $this->drupalGetHeaders(TRUE);
       $this->assertEqual(count($headers), 2, 'There was one intermediate request.');
       $this->assertTrue(strpos($headers[0][':status'], '302') !== FALSE, 'Intermediate response code was 302.');
@@ -76,6 +79,8 @@ function testInternalBrowser() {
 
       // Test the maximum redirection option.
       $this->drupalLogout();
+      // Check that current user service updated.
+      $this->assertEqual(0, $this->container->get('current_user')->id(), 'Current user service updated.');
       $edit = array(
         'name' => $user->getUsername(),
         'pass' => $user->pass_raw
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 300430a..a064d01 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -639,6 +639,7 @@ protected function drupalLogin(AccountInterface $account) {
     $pass = $this->assert($this->drupalUserIsLoggedIn($account), format_string('User %name successfully logged in.', array('%name' => $account->getUsername())), 'User login');
     if ($pass) {
       $this->loggedInUser = $account;
+      $this->container->set('current_user', $account);
     }
   }
 
@@ -682,6 +683,7 @@ protected function drupalLogout() {
       // @see WebTestBase::drupalUserIsLoggedIn()
       unset($this->loggedInUser->session_id);
       $this->loggedInUser = FALSE;
+      $this->container->set('current_user', drupal_anonymous_user());
     }
   }
 
