diff --git a/core/modules/comment/tests/Drupal/comment/Tests/Entity/CommentLockTest.php b/core/modules/comment/tests/Drupal/comment/Tests/Entity/CommentLockTest.php
index 887d3ca..0dcbf28 100644
--- a/core/modules/comment/tests/Drupal/comment/Tests/Entity/CommentLockTest.php
+++ b/core/modules/comment/tests/Drupal/comment/Tests/Entity/CommentLockTest.php
@@ -35,7 +35,7 @@ public static function getInfo() {
   public function testLocks() {
     $container = new ContainerBuilder();
     $container->set('module_handler', $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'));
-    $container->set('current_user', $this->getMock('Drupal\Core\Session\AccountInterface'));
+    $container->set('current_user', $this->getMock('Drupal\Core\Session\AccountProxyInterface'));
     $container->set('cache.test', $this->getMock('Drupal\Core\Cache\CacheBackendInterface'));
     $container->setParameter('cache_bins', array('cache.test' => 'test'));
     $container->register('request', 'Symfony\Component\HttpFoundation\Request');
diff --git a/core/modules/locale/tests/Drupal/locale/Tests/LocaleLookupTest.php b/core/modules/locale/tests/Drupal/locale/Tests/LocaleLookupTest.php
index a62e40d..f67e4f4 100644
--- a/core/modules/locale/tests/Drupal/locale/Tests/LocaleLookupTest.php
+++ b/core/modules/locale/tests/Drupal/locale/Tests/LocaleLookupTest.php
@@ -84,7 +84,7 @@ protected function setUp() {
     $this->lock->expects($this->never())
       ->method($this->anything());
 
-    $this->user = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $this->user = $this->getMock('Drupal\Core\Session\AccountProxyInterface');
     $this->user->expects($this->any())
       ->method('getRoles')
       ->will($this->returnValue(array('anonymous')));
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 627f6dc..031fe2e 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -8,6 +8,7 @@
 namespace Drupal\simpletest;
 
 use Drupal\Component\Utility\Random;
+use Drupal\Core\Authentication\AuthenticationManager;
 use Drupal\Core\Database\Database;
 use Drupal\Component\Utility\String;
 use Drupal\Core\Config\ConfigImporter;
@@ -1089,9 +1090,14 @@ private function prepareEnvironment() {
     $request = Request::create('/');
     $this->container->set('request', $request);
 
+    $account_proxy = new AccountProxy(new AuthenticationManager(), $request);
+
     // Run all tests as a anonymous user by default, web tests will replace that
     // during the test set up.
-    $this->container->set('current_user', new AnonymousUserSession());
+    $account_proxy->setAccount(new AnonymousUserSession());
+
+    $this->container->set('current_user', $account_proxy);
+
 
     \Drupal::setContainer($this->container);
 
@@ -1229,7 +1235,9 @@ private function restoreEnvironment() {
     $callbacks = $this->originalShutdownCallbacks;
 
     // Restore original user session.
-    $this->container->set('current_user', $this->originalUser);
+    $current_user = $this->container->get('current_user');
+    $current_user->setAccount($this->originalUser);
+
     \Drupal::service('session_manager')->enable();
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
index db904e3..4e3939f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Form;
 
+use Drupal\Core\Session\AnonymousUserSession;
 use Drupal\Core\Session\UserSession;
 use Drupal\simpletest\DrupalUnitTestBase;
 
@@ -75,7 +76,8 @@ function testCacheToken() {
    * Tests the form cache without a logged-in user.
    */
   function testNoCacheToken() {
-    $this->container->set('current_user', new UserSession(array('uid' => 0)));
+    $current_user = $this->container->get('current_user');
+    $current_user->setAccount(new AnonymousUserSession());
 
     $this->form_state['example'] = $this->randomName();
     form_set_cache($this->form_build_id, $this->form, $this->form_state);
diff --git a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php
index 7cbf7b9..f8e9650 100644
--- a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php
+++ b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php
@@ -89,7 +89,7 @@ public function testIsLocked() {
       ->disableOriginalConstructor()
       ->setConstructorArgs(array($storage))
       ->getMock();
-    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account = $this->getMock('Drupal\Core\Session\AccountProxyInterface');
     $account->expects($this->exactly(2))
       ->method('id')
       ->will($this->returnValue(1));
