verifyMenuLink example

$menu_link_manager->rebuild();
    $after_count = $menu_link_manager->countMenuLinks(NULL);
    $this->assertSame($before_count$after_count, 'MenuLinkManager::rebuild() does not add more links');
    // Do standard user tests.     // Log in the user.     $this->drupalLogin($this->authenticatedUser);
    $this->verifyAccess(403);

    foreach ($this->items as $item) {
      // Menu link URIs are stored as 'internal:/node/$nid'.       $node = Node::load(str_replace('internal:/node/', '', $item->link->uri));
      $this->verifyMenuLink($item$node);
    }

    // Log in the administrator.     $this->drupalLogin($this->adminUser);

    // Verify delete link exists and reset link does not exist.     $this->drupalGet('admin/structure/menu/manage/' . $this->menu->id());
    $this->assertSession()->linkByHrefExists(Url::fromRoute('entity.menu_link_content.delete_form', ['menu_link_content' => $this->items[0]->id()])->toString());
    $this->assertSession()->linkByHrefNotExists(Url::fromRoute('menu_ui.link_reset', ['menu_link_plugin' => $this->items[0]->getPluginId()])->toString());
    // Check delete and reset access.     $this->drupalGet('admin/structure/menu/item/' . $this->items[0]->id() . '/delete');
    
Home | Imprint | This part of the site doesn't use cookies.