protected function assertEntity(string
$id, string
$title, string
$menu, ?string
$description, bool
$enabled, bool
$expanded, array
$attributes, string
$uri, int
$weight): void
{ /** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link */
$menu_link = MenuLinkContent::
load($id);
$this->
assertInstanceOf(MenuLinkContentInterface::
class,
$menu_link);
$this->
assertSame($title,
$menu_link->
getTitle());
$this->
assertSame($menu,
$menu_link->
getMenuName());
$this->
assertSame($description,
$menu_link->
getDescription());
$this->
assertSame($enabled,
$menu_link->
isEnabled());
$this->
assertSame($expanded,
$menu_link->
isExpanded());
$this->
assertSame($attributes,
$menu_link->link->options
);
$this->
assertSame($uri,
$menu_link->link->uri
);
$this->
assertSame($weight,
$menu_link->
getWeight());
} /**
* Tests migration of menu links.
*/
public function testMenuLinks() { $this->
assertEntity('138', 'Test 1', 'secondary-links', 'Test menu link 1', TRUE, FALSE,
['attributes' =>
['title' => 'Test menu link 1'
], 'langcode' => 'en'
], 'internal:/user/login', -50
);
$this->
assertEntity('139', 'Test 2', 'secondary-links', 'Test menu link 2', TRUE, TRUE,
['query' =>
['foo' => 'bar'
], 'attributes' =>
['title' => 'Test menu link 2'
]], 'internal:/admin', -49
);
$this->
assertEntity('140', 'Drupal.org', 'secondary-links', NULL, TRUE, FALSE,
['attributes' =>
['title' => ''
]], 'https://www.drupal.org', -50
);
// Assert that missing title attributes don't stop or break migration.