function ShortcutCacheTagsTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php \Drupal\Tests\shortcut\Functional\ShortcutCacheTagsTest::setUp()
  2. 10 core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php \Drupal\Tests\shortcut\Functional\ShortcutCacheTagsTest::setUp()
  3. 11.x core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php \Drupal\Tests\shortcut\Functional\ShortcutCacheTagsTest::setUp()

Overrides EntityCacheTagsTestBase::setUp

File

core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php, line 39

Class

ShortcutCacheTagsTest
Tests the Shortcut entity's cache tags.

Namespace

Drupal\Tests\shortcut\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // Give anonymous users permission to customize shortcut links, so that we
    // can verify the cache tags of cached versions of shortcuts.
    $user_role = Role::load(RoleInterface::ANONYMOUS_ID);
    $user_role->grantPermission('customize shortcut links');
    $user_role->grantPermission('access shortcuts');
    $user_role->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.