function LinksTest::assertMenuLinkParents

Assert that at set of links is properly parented.

2 calls to LinksTest::assertMenuLinkParents()
LinksTest::testMenuLinkReparenting in drupal/core/modules/system/lib/Drupal/system/Tests/Menu/LinksTest.php
Test automatic reparenting of menu links.
LinksTest::testMenuLinkRouterReparenting in drupal/core/modules/system/lib/Drupal/system/Tests/Menu/LinksTest.php
Test automatic reparenting of menu links derived from menu routers.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Menu/LinksTest.php, line 78
Definition of Drupal\system\Tests\Menu\LinksTest.

Class

LinksTest
Tests for menu links.

Namespace

Drupal\system\Tests\Menu

Code

function assertMenuLinkParents($links, $expected_hierarchy) {
  foreach ($expected_hierarchy as $child => $parent) {
    $mlid = $links[$child]['mlid'];
    $plid = $parent ? $links[$parent]['mlid'] : 0;
    $menu_link = menu_link_load($mlid);
    menu_link_save($menu_link);
    $this
      ->assertEqual($menu_link['plid'], $plid, format_string('Menu link %mlid has parent of %plid, expected %expected_plid.', array(
      '%mlid' => $mlid,
      '%plid' => $menu_link['plid'],
      '%expected_plid' => $plid,
    )));
  }
}