function MenuTestCase::addInvalidMenuLink

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

Parameters

string $menu_name Menu name.:

2 calls to MenuTestCase::addInvalidMenuLink()
MenuTestCase::doCustomMenuTests in modules/menu/menu.test
Test custom menu functionality using navigation menu.
MenuTestCase::doStandardMenuTests in modules/menu/menu.test
Test standard menu functionality using navigation menu.

File

modules/menu/menu.test, line 361

Class

MenuTestCase
@file Tests for menu.module.

Code

function addInvalidMenuLink($menu_name = 'navigation') {
    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');
    }
}

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