function MenuUiTest::addInvalidMenuLink

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

Class

MenuUiTest
Tests the menu 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.");
    }
}

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