You are here

protected function MenuLinkWeightTestTrait::assertLinkWeight in Menu Link Weight 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/MenuLinkWeightTestTrait.php \Drupal\Tests\menu_link_weight\FunctionalJavascript\MenuLinkWeightTestTrait::assertLinkWeight()

Asserts the weight of a menu link.

Parameters

string $link_id: The plugin ID of the link.

int $expected_weight: The expected weight of the link.

2 calls to MenuLinkWeightTestTrait::assertLinkWeight()
MenuLinkWeightMenuUiTest::testMenuFunctionality in tests/src/Functional/MenuLinkWeightMenuUiTest.php
Test creating, editing, deleting menu links via menu link form.
MenuLinkWeightNodeTest::testNodeForm in tests/src/Functional/MenuLinkWeightNodeTest.php
Tests menu node form integration.

File

tests/src/FunctionalJavascript/MenuLinkWeightTestTrait.php, line 17

Class

MenuLinkWeightTestTrait

Namespace

Drupal\Tests\menu_link_weight\FunctionalJavascript

Code

protected function assertLinkWeight($link_id, $expected_weight) {
  $this->menuLinkManager
    ->resetDefinitions();

  // Retrieve the menu link.

  /** @var \Drupal\Core\Menu\MenuLinkInterface $link */
  $link = $this->menuLinkManager
    ->createInstance($link_id);
  $this
    ->assertEquals($expected_weight, $link
    ->getWeight());
}