You are here

public function BigMenuUiTest::testBigMenuUiDeleteMenuLink in Big Menu 2.x

Tests for deleting a menu link when viewing children.

File

tests/src/Functional/BigMenuUiTest.php, line 122

Class

BigMenuUiTest
Tests the Big Menu interface.

Namespace

Drupal\Tests\bigmenu\Functional

Code

public function testBigMenuUiDeleteMenuLink() {
  $assert = $this
    ->assertSession();
  $this
    ->drupalLogin($this->adminUser);

  // Add new menu items in a hierarchy.
  $item1 = $this
    ->createMenuLink('Item 1');
  $this
    ->createMenuLink('Item 1 - 1', 'internal:/', $item1
    ->uuid());
  $this
    ->drupalGet('admin/structure/menu/manage/main');
  $this
    ->clickLink('Edit child items');
  $this
    ->clickLinkInRow('Item 1 - 1', 'Delete');
  $this
    ->submitForm([], 'Delete');
  $assert
    ->pageTextContains('The menu link Item 1 - 1 has been deleted.');
  $this
    ->clickLinkInRow('Item 1', 'Delete');
  $this
    ->submitForm([], 'Delete');
  $assert
    ->statusCodeEquals(200);
  $assert
    ->pageTextContains('The menu link Item 1 has been deleted.');
  $assert
    ->pageTextContains('There are no menu links yet');
}