function 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 56  
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.