function MenuTestCase::testMenuQueryAndFragment

7.x menu.test MenuTestCase::testMenuQueryAndFragment()

Add and remove a menu link with a query string and fragment.

File

drupal-7.x/modules/menu/menu.test, line 261
Tests for menu.module.

Class

MenuTestCase

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.');
}