diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
index 654d1d7..655ae61 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
@@ -33,17 +33,17 @@ public function test_plugin_argument_default_current_user() {

     // Switch the user, we have to check the global user too, because drupalLogin is only for the simpletest browser.
     $this->drupalLogin($account);
-    global $user;
-    $admin = $user;
+
+    $admin = \Drupal::currentUser();
     drupal_save_session(FALSE);
-    $user = $account;
+    \Drupal::getContainer()->set('current_user', $account);

     $view = views_get_view('test_plugin_argument_default_current_user');
     $view->initHandlers();

     $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->id(), 'Uid of the current user is used.');
     // Switch back.
-    $user = $admin;
+    \Drupal::getContainer()->set('current_user', $admin);
     drupal_save_session(TRUE);
   }

