function MenuUiTest::resetMenuLink

Same name in other branches
  1. 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::resetMenuLink()
  2. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::resetMenuLink()
  3. 11.x 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.

1 call to MenuUiTest::resetMenuLink()
MenuUiTest::testMenuAdministration in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Tests menu functionality using the admin and user interfaces.

File

core/modules/menu_ui/tests/src/Functional/MenuUiTest.php, line 878

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.