3 namespace Drupal\Tests\user\Functional;
5 use Drupal\system\Tests\Entity\EntityWithUriCacheTagsTestBase;
6 use Drupal\user\Entity\Role;
7 use Drupal\user\Entity\User;
8 use Drupal\user\RoleInterface;
11 * Tests the User entity's cache tags.
15 class UserCacheTagsTest extends EntityWithUriCacheTagsTestBase {
20 public static $modules = ['user'];
25 protected function setUp() {
28 // Give anonymous users permission to view user profiles, so that we can
29 // verify the cache tags of cached versions of user profile pages.
30 $user_role = Role::load(RoleInterface::ANONYMOUS_ID);
31 $user_role->grantPermission('access user profiles');
38 protected function createEntity() {
39 // Create a "Llama" user.
40 $user = User::create([
52 protected function getAdditionalCacheTagsForEntityListing() {
53 return ['user:0', 'user:1'];