diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php index a30b7a59c3..7c7f68bc66 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php @@ -28,36 +28,6 @@ class ShortcutCacheTagsTest extends PageCacheTagsTestBase { */ protected $defaultTheme = 'stark'; - /** - * {@inheritdoc} - */ - 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(); - } - - /** - * {@inheritdoc} - */ - protected function createEntity() { - // Create a "Llama" shortcut. - $shortcut = Shortcut::create([ - 'shortcut_set' => 'default', - 'title' => t('Llama'), - 'weight' => 0, - 'link' => [['uri' => 'internal:/admin']], - ]); - $shortcut->save(); - - return $shortcut; - } - /** * Tests that when creating a shortcut, the shortcut set tag is invalidated. */ @@ -72,7 +42,13 @@ public function testEntityCreation() { $this->assertEquals($cache_tags, $item->tags); // Now create a shortcut entity in that shortcut set. - $this->createEntity(); + $shortcut = Shortcut::create([ + 'shortcut_set' => 'default', + 'title' => t('Llama'), + 'weight' => 0, + 'link' => [['uri' => 'internal:/admin']], + ]); + $shortcut->save(); // Verify a cache miss. $this->assertFalse($render_cache->get('foo'), 'Creating a new shortcut invalidates the cache tag of the shortcut set.');