You are here

protected function ShortcutResourceTestBase::createEntity in Drupal 10

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

File

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

Class

ShortcutResourceTestBase
ResourceTestBase for Shortcut entity.

Namespace

Drupal\Tests\shortcut\Functional\Rest

Code

protected function createEntity() {

  // Create shortcut.
  $shortcut = Shortcut::create([
    'shortcut_set' => 'default',
    'title' => t('Comments'),
    'weight' => -20,
    'link' => [
      'uri' => 'internal:/admin/content/comment',
      'options' => [
        'fragment' => 'new',
      ],
    ],
  ]);
  $shortcut
    ->save();
  return $shortcut;
}