resetMenuLink example

    $edit = [];
    $edit['weight'] = 10;
    $id = $instance->getPluginId();
    $this->drupalGet("admin/structure/menu/link/{$id}/edit");
    $this->submitForm($edit, 'Save');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains('The menu link has been saved.');
    $menu_link_manager->resetDefinitions();

    $instance = $menu_link_manager->createInstance($instance->getPluginId());
    $this->assertEquals($edit['weight']$instance->getWeight(), 'Saving an existing link updates the weight.');
    $this->resetMenuLink($instance$old_weight);
  }

  /** * Adds a custom menu using CRUD functions. */
  public function addCustomMenuCRUD() {
    // Add a new custom menu.     $menu_name = strtolower($this->randomMachineName(MenuStorage::MAX_ID_LENGTH));
    $label = $this->randomMachineName(16);

    $menu = Menu::create([
      
Home | Imprint | This part of the site doesn't use cookies.