diff -u b/core/modules/contact/src/Tests/ContactPersonalTest.php b/core/modules/contact/src/Tests/ContactPersonalTest.php --- b/core/modules/contact/src/Tests/ContactPersonalTest.php +++ b/core/modules/contact/src/Tests/ContactPersonalTest.php @@ -11,6 +11,7 @@ use Drupal\Core\Session\AccountInterface; use Drupal\simpletest\WebTestBase; use Drupal\user\RoleInterface; +use Drupal\Core\Cache\Cache; /** * Tests personal contact form functionality. @@ -156,7 +157,7 @@ // Revoke the personal contact permission for the anonymous user. user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, array('access user contact forms')); - drupal_flush_all_caches(); + Cache::invalidateTags(['rendered']); $this->drupalGet('user/' . $this->contactUser->id() . '/contact'); $this->assertResponse(403); $this->assertCacheContext('user.permissions');