summaryrefslogtreecommitdiff
path: root/modules/menu/menu.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-02-15 15:29:14 +0000
committerDries Buytaert <dries@buytaert.net>2010-02-15 15:29:14 +0000
commit86dc8b4bc699b3a0bd7cc83865802dcdafff2246 (patch)
treece21eeef627d9d515840aa0f25e484513f04bab5 /modules/menu/menu.test
parentd89f0464264cb227a917a64660466099d93958aa (diff)
downloadbrdo-86dc8b4bc699b3a0bd7cc83865802dcdafff2246.tar.gz
brdo-86dc8b4bc699b3a0bd7cc83865802dcdafff2246.tar.bz2
- Patch #682784 by naxoc: added a test for updating links with queries and fragments in menu items.
Diffstat (limited to 'modules/menu/menu.test')
-rw-r--r--modules/menu/menu.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/menu/menu.test b/modules/menu/menu.test
index 40ded5296..f00238e9b 100644
--- a/modules/menu/menu.test
+++ b/modules/menu/menu.test
@@ -228,6 +228,26 @@ class MenuTestCase extends DrupalWebTestCase {
}
/**
+ * Add and remove a menu link with a query string and fragment.
+ */
+ 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, t('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, t('Path no longer has query or fragment.'));
+ }
+
+ /**
* Add a menu link using the menu module UI.
*
* @param integer $plid Parent menu link id.
@@ -268,6 +288,13 @@ class MenuTestCase extends DrupalWebTestCase {
// Both menu links were created in the navigation menu.
$this->assertEqual($item['menu_name'], $menu_name);
$this->assertEqual($item['plid'], $plid);
+ $options = unserialize($item['options']);
+ if (!empty($options['query'])) {
+ $item['link_path'] .= '?' . drupal_http_build_query($options['query']);
+ }
+ if (!empty($options['fragment'])) {
+ $item['link_path'] .= '#' . $options['fragment'];
+ }
$this->assertEqual($item['link_path'], $link);
$this->assertEqual($item['link_title'], $title);
if ($plid == 0) {