function MenuTest::addInvalidMenuLink

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

Parameters

string $menu_name Menu name.:

2 calls to MenuTest::addInvalidMenuLink()
MenuTest::doCustomMenuTests in drupal/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
Tests custom menu functionality using the Tools menu.
MenuTest::doStandardMenuTests in drupal/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
Tests standard menu functionality using the Tools menu.

File

drupal/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php, line 341
Definition of Drupal\menu\Tests\MenuTest.

Class

MenuTest

Namespace

Drupal\menu\Tests

Code

function addInvalidMenuLink($menu_name = 'tools') {
  foreach (array(
    '-&-',
    'admin/people/permissions',
    '#',
  ) as $link_path) {
    $edit = array(
      'link_path' => $link_path,
      'link_title' => 'title',
    );
    $this
      ->drupalPost("admin/structure/menu/manage/{$menu_name}/add", $edit, t('Save'));
    $this
      ->assertRaw(t("The path '@path' is either invalid or you do not have access to it.", array(
      '@path' => $link_path,
    )), 'Menu link was not created');
  }
}