function LinksTest::assertMenuLinkParents in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/menu_link_content/src/Tests/LinksTest.php \Drupal\menu_link_content\Tests\LinksTest::assertMenuLinkParents()
Assert that at set of links is properly parented.
1 call to LinksTest::assertMenuLinkParents()
- LinksTest::testMenuLinkReparenting in core/
modules/ menu_link_content/ src/ Tests/ LinksTest.php - Test automatic reparenting of menu links.
File
- core/
modules/ menu_link_content/ src/ Tests/ LinksTest.php, line 113 - Contains \Drupal\menu_link_content\Tests\LinksTest.
Class
- LinksTest
- Tests handling of menu links hierarchies.
Namespace
Drupal\menu_link_content\TestsCode
function assertMenuLinkParents($links, $expected_hierarchy) {
foreach ($expected_hierarchy as $id => $parent) {
/* @var \Drupal\Core\Menu\MenuLinkInterface $menu_link_plugin */
$menu_link_plugin = $this->menuLinkManager
->createInstance($links[$id]);
$expected_parent = isset($links[$parent]) ? $links[$parent] : '';
$this
->assertEqual($menu_link_plugin
->getParent(), $expected_parent, SafeMarkup::format('Menu link %id has parent of %parent, expected %expected_parent.', array(
'%id' => $id,
'%parent' => $menu_link_plugin
->getParent(),
'%expected_parent' => $expected_parent,
)));
}
}