diff -u b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php --- b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php @@ -106,8 +106,6 @@ * Tests the form cache with an overridden cache expiration. */ public function testCacheCustomExpiration() { - \Drupal::currentUser()->setAccount(new UserSession(['uid' => 1])); - // Override form cache expiration so that the cached form expired yesterday. new Settings(['form_cache_expiration' => -1 * (24*60*60), 'hash_salt' => $this->randomMachineName()]); \Drupal::formBuilder()->setCache($this->formBuildId, $this->form, $this->formState);