function ShortcutCacheTagsTest::createShortcutEntity
Creates a shortcut entity in the default shortcut set.
1 call to ShortcutCacheTagsTest::createShortcutEntity()
- ShortcutCacheTagsTest::testEntityCreation in core/
modules/ shortcut/ tests/ src/ Kernel/ ShortcutCacheTagsTest.php - Tests that when creating a shortcut, the shortcut set tag is invalidated.
File
-
core/
modules/ shortcut/ tests/ src/ Kernel/ ShortcutCacheTagsTest.php, line 77
Class
- ShortcutCacheTagsTest
- Tests the Shortcut entity's cache tags.
Namespace
Drupal\Tests\shortcut\KernelCode
protected function createShortcutEntity() : Shortcut {
// Create a "Llama" shortcut.
$shortcut = Shortcut::create([
'shortcut_set' => $this->shortcutSet
->id(),
'title' => 'Llama',
'weight' => 0,
'link' => [
[
'uri' => 'internal:/admin',
],
],
]);
$shortcut->save();
return $shortcut;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.