function ShortcutCacheTagsTest::setUp

Same name in other branches
  1. 9 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()
  4. 11.x core/modules/shortcut/tests/src/Kernel/ShortcutCacheTagsTest.php \Drupal\Tests\shortcut\Kernel\ShortcutCacheTagsTest::setUp()

Overrides EntityCacheTagsTestBase::setUp

File

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

Class

ShortcutCacheTagsTest
Tests the Shortcut entity's cache tags.

Namespace

Drupal\Tests\shortcut\Functional

Code

protected function setUp() {
    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.