diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
index 40a7e44..bc19712 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
@@ -105,9 +105,10 @@ public function testEntityLanguageMethods() {
    *   The entity type to run the tests with.
    */
   protected function assertEntityLanguageMethods($entity_type) {
-    $entity = entity_create($entity_type, array(
+      $user = $this->container->get('request')->attributes->get('_account');
+      $entity = entity_create($entity_type, array(
       'name' => 'test',
-      'user_id' => $GLOBALS['user']->id(),
+      'user_id' => $user->id(),
     ));
     $this->assertEqual($entity->language()->id, Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity language not specified.', array('%entity_type' => $entity_type)));
     $this->assertFalse($entity->getTranslationLanguages(FALSE), format_string('%entity_type: No translations are available', array('%entity_type' => $entity_type)));
