You are here

protected function ShortcutCacheTagsTest::createEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php \Drupal\Tests\shortcut\Functional\ShortcutCacheTagsTest::createEntity()
  2. 9 core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php \Drupal\Tests\shortcut\Functional\ShortcutCacheTagsTest::createEntity()

File

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

Class

ShortcutCacheTagsTest
Tests the Shortcut entity's cache tags.

Namespace

Drupal\Tests\shortcut\Functional

Code

protected function createEntity() {

  // Create a "Llama" shortcut.
  $shortcut = Shortcut::create([
    'shortcut_set' => 'default',
    'title' => 'Llama',
    'weight' => 0,
    'link' => [
      [
        'uri' => 'internal:/admin',
      ],
    ],
  ]);
  $shortcut
    ->save();
  return $shortcut;
}