You are here

function MenuTest::resetMenuLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/menu_ui/src/Tests/MenuTest.php \Drupal\menu_ui\Tests\MenuTest::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 MenuTest::resetMenuLink()
MenuTest::testMenu in core/modules/menu_ui/src/Tests/MenuTest.php
Tests menu functionality using the admin and user interfaces.

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 785
Contains \Drupal\menu_ui\Tests\MenuTest.

Class

MenuTest
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\menu_ui\Tests

Code

function resetMenuLink(MenuLinkInterface $menu_link, $old_weight) {

  // Reset menu link.
  $this
    ->drupalPostForm("admin/structure/menu/link/{$menu_link->getPluginId()}/reset", array(), t('Reset'));
  $this
    ->assertResponse(200);
  $this
    ->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset');

  // Verify menu link.
  $instance = \Drupal::service('plugin.manager.menu.link')
    ->createInstance($menu_link
    ->getPluginId());
  $this
    ->assertEqual($old_weight, $instance
    ->getWeight(), 'Resets to the old weight.');
}