protected function ShortcutResourceTestBase::createEntity in Drupal 9
Same name and namespace in other branches
- 8 core/modules/shortcut/tests/src/Functional/Rest/ShortcutResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutResourceTestBase::createEntity()
Creates the entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface The entity to be tested.
Overrides EntityResourceTestBase::createEntity
File
- core/
modules/ shortcut/ tests/ src/ Functional/ Rest/ ShortcutResourceTestBase.php, line 53
Class
- ShortcutResourceTestBase
- ResourceTestBase for Shortcut entity.
Namespace
Drupal\Tests\shortcut\Functional\RestCode
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;
}