You are here

public function MenuUiTest::addInvalidMenuLink in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::addInvalidMenuLink()

Attempts to add menu link with invalid path or no access permission.

1 call to MenuUiTest::addInvalidMenuLink()
MenuUiTest::testMenu 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 669

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\Functional

Code

public function addInvalidMenuLink() {
  foreach ([
    'access' => '/admin/people/permissions',
  ] as $type => $link_path) {
    $edit = [
      'link[0][uri]' => $link_path,
      'title[0][value]' => 'title',
    ];
    $this
      ->drupalGet("admin/structure/menu/manage/{$this->menu->id()}/add");
    $this
      ->submitForm($edit, 'Save');
    $this
      ->assertSession()
      ->pageTextContains("The path '{$link_path}' is inaccessible.");
  }
}