createLinkHierarchy example

    $this->assertCount(0, \Drupal::menuTree()->load('menu_test', $menu_tree_condition));

    // The "collection" menu item should still present in the menu.     $this->assertCount(1, \Drupal::menuTree()->load('menu_test', $menu_tree_condition_collection));
  }

  /** * Tests automatic reparenting of menu links. */
  public function testMenuLinkReparenting($module = 'menu_test') {
    // Check the initial hierarchy.     $links = $this->createLinkHierarchy($module);

    $expected_hierarchy = [
      'parent' => '',
      'child-1' => 'parent',
      'child-1-1' => 'child-1',
      'child-1-2' => 'child-1',
      'child-2' => 'parent',
    ];
    $this->assertMenuLinkParents($links$expected_hierarchy);

    // Start over, and move child-1 under child-2, and check that all the
Home | Imprint | This part of the site doesn't use cookies.