summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/menu.test
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-12-02 17:34:24 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-12-02 17:34:24 +0000
commit44aefb0a4e7e7794fc74f0fe48b10fae1b546699 (patch)
treeabdcd64463fd7c6eda4a5c9a4e09cead358aed46 /modules/simpletest/tests/menu.test
parent35caf24c35f0c4a3925217d9c3be5596760cd7eb (diff)
downloadbrdo-44aefb0a4e7e7794fc74f0fe48b10fae1b546699.tar.gz
brdo-44aefb0a4e7e7794fc74f0fe48b10fae1b546699.tar.bz2
#979958 by das-peter, Damien Tournoud: Fixed regression in load_functions detection for menu items
Diffstat (limited to 'modules/simpletest/tests/menu.test')
-rw-r--r--modules/simpletest/tests/menu.test62
1 files changed, 52 insertions, 10 deletions
diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test
index f46b81df4..c25240e99 100644
--- a/modules/simpletest/tests/menu.test
+++ b/modules/simpletest/tests/menu.test
@@ -475,19 +475,61 @@ class MenuRouterTestCase extends DrupalWebTestCase {
}
/**
+ * Load the router for a given path.
+ */
+ protected function menuLoadRouter($router_path) {
+ return db_query('SELECT * FROM {menu_router} WHERE path = :path', array(':path' => $router_path))->fetchAssoc();
+ }
+
+ /**
* Tests inheritance of 'load arguments'.
*/
function testMenuLoadArgumentsInheritance() {
- $arg1 = $this->randomName();
- $arg2 = $this->randomName();
- $expected = print_r(array('%menu_test_argument' => $arg1, '%' => $arg2), TRUE);
-
- $this->drupalGet("menu-test/arguments/$arg1/$arg2");
- $this->assertRaw($expected, t('Inherited load arguments found.'));
- $this->drupalGet("menu-test/arguments/$arg1/$arg2/default");
- $this->assertRaw($expected, t('Inherited load arguments found.'));
- $this->drupalGet("menu-test/arguments/$arg1/$arg2/task");
- $this->assertRaw($expected, t('Inherited load arguments found.'));
+ $expected = array(
+ 'menu-test/arguments/%/%' => array(
+ 2 => array('menu_test_argument_load' => array(3)),
+ 3 => NULL,
+ ),
+ // Arguments are inherited to normal children.
+ 'menu-test/arguments/%/%/default' => array(
+ 2 => array('menu_test_argument_load' => array(3)),
+ 3 => NULL,
+ ),
+ // Arguments are inherited to tab children.
+ 'menu-test/arguments/%/%/task' => array(
+ 2 => array('menu_test_argument_load' => array(3)),
+ 3 => NULL,
+ ),
+ // Arguments are only inherited to the same loader functions.
+ 'menu-test/arguments/%/%/common-loader' => array(
+ 2 => array('menu_test_argument_load' => array(3)),
+ 3 => 'menu_test_other_argument_load',
+ ),
+ // Arguments are not inherited to children not using the same loader
+ // function.
+ 'menu-test/arguments/%/%/different-loaders-1' => array(
+ 2 => NULL,
+ 3 => 'menu_test_argument_load',
+ ),
+ 'menu-test/arguments/%/%/different-loaders-2' => array(
+ 2 => 'menu_test_other_argument_load',
+ 3 => NULL,
+ ),
+ 'menu-test/arguments/%/%/different-loaders-3' => array(
+ 2 => NULL,
+ 3 => NULL,
+ ),
+ // Explicit loader arguments should not be overriden by parent.
+ 'menu-test/arguments/%/%/explicit-arguments' => array(
+ 2 => array('menu_test_argument_load' => array()),
+ 3 => NULL,
+ ),
+ );
+
+ foreach ($expected as $router_path => $load_functions) {
+ $router_item = $this->menuLoadRouter($router_path);
+ $this->assertIdentical(unserialize($router_item['load_functions']), $load_functions, t('Expected load functions for router %router_path' , array('%router_path' => $router_path)));
+ }
}
}