You are here

public function MenuUiTest::addInvalidMenuLink in Drupal 8

Same name and namespace in other branches
  1. 9 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 644

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
      ->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save'));
    $this
      ->assertRaw(t("The path '@link_path' is inaccessible.", [
      '@link_path' => $link_path,
    ]), 'Menu link was not created');
  }
}