public function MenuUiTest::resetMenuLink in Drupal 10
Same name and namespace in other branches
- 8 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::resetMenuLink()
- 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::resetMenuLink()
Resets a standard menu link using the UI.
Parameters
\Drupal\Core\Menu\MenuLinkInterface $menu_link: The Menu link.
int $old_weight: Original title for menu link.
File
- core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php, line 873
Class
- MenuUiTest
- Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.
Namespace
Drupal\Tests\menu_ui\FunctionalCode
public function resetMenuLink(MenuLinkInterface $menu_link, $old_weight) {
// Reset menu link.
$this
->drupalGet("admin/structure/menu/link/{$menu_link->getPluginId()}/reset");
$this
->submitForm([], 'Reset');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('The menu link was reset to its default settings.');
// Verify menu link.
$instance = \Drupal::service('plugin.manager.menu.link')
->createInstance($menu_link
->getPluginId());
$this
->assertEquals($old_weight, $instance
->getWeight(), 'Resets to the old weight.');
}