1 menu.test MenuTestCase::testMenuQueryAndFragment()

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

File

core/modules/menu/tests/menu.test, line 298
Tests for menu.module.

Class

MenuTestCase

Code

function testMenuQueryAndFragment() {
  $this->backdropLogin($this->big_user);

  // Make a path with query and fragment on.
  $path = 'node?arg1=value1&arg2=value2';
  $item = $this->addMenuLink(0, $path);

  $this->backdropGet('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->backdropPost('admin/structure/menu/item/' . $item['mlid'] . '/edit', array('link_path' => $path), t('Save'));
  $this->backdropGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
  $this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.');
}