function MenuLinkContentTest::createEntity

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php \Drupal\Tests\jsonapi\Functional\MenuLinkContentTest::createEntity()
  2. 10 core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php \Drupal\Tests\jsonapi\Functional\MenuLinkContentTest::createEntity()
  3. 11.x core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php \Drupal\Tests\jsonapi\Functional\MenuLinkContentTest::createEntity()

Overrides ResourceTestBase::createEntity

File

core/modules/jsonapi/tests/src/Functional/MenuLinkContentTest.php, line 70

Class

MenuLinkContentTest
JSON:API integration test for the "MenuLinkContent" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {
    $menu_link = MenuLinkContent::create([
        'id' => 'llama',
        'title' => 'Llama Gabilondo',
        'description' => 'Llama Gabilondo',
        'link' => 'https://nl.wikipedia.org/wiki/Llama',
        '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.