protected function MenuLinkContentResourceTestBase::createEntity in Drupal 8
Same name and namespace in other branches
- 9 core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php \Drupal\Tests\menu_link_content\Functional\Rest\MenuLinkContentResourceTestBase::createEntity()
Creates the entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface The entity to be tested.
Overrides EntityResourceTestBase::createEntity
File
- core/
modules/ menu_link_content/ tests/ src/ Functional/ Rest/ MenuLinkContentResourceTestBase.php, line 57
Class
- MenuLinkContentResourceTestBase
- ResourceTestBase for MenuLinkContent entity.
Namespace
Drupal\Tests\menu_link_content\Functional\RestCode
protected function createEntity() {
$menu_link = MenuLinkContent::create([
'id' => 'llama',
'title' => 'Llama Gabilondo',
'description' => 'Llama Gabilondo',
'link' => [
'uri' => 'https://nl.wikipedia.org/wiki/Llama',
'options' => [
'fragment' => 'a-fragment',
'attributes' => [
'class' => [
'example-class',
],
],
],
],
'weight' => 0,
'menu_name' => 'main',
]);
$menu_link
->save();
return $menu_link;
}