function MenuTestCase::testMenuQueryAndFragment
Add and remove a menu link with a query string and fragment.
File
-
modules/
menu/ menu.test, line 280
Class
- MenuTestCase
- @file Tests for menu.module.
Code
function testMenuQueryAndFragment() {
$this->drupalLogin($this->big_user);
// Make a path with query and fragment on.
$path = 'node?arg1=value1&arg2=value2';
$item = $this->addMenuLink(0, $path);
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
$this->assertFieldByName('link_path', $path, 'Path is found with both query and fragment.');
// Now change the path to something without query and fragment.
$path = 'node';
$this->drupalPost('admin/structure/menu/item/' . $item['mlid'] . '/edit', array(
'link_path' => $path,
), t('Save'));
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
$this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.