diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-03-14 20:56:06 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-03-14 20:56:06 +0000 |
commit | 56e1c5d106f9d1fa520c16803d812e7bca02e4b3 (patch) | |
tree | 93329551df2aa3d13adb87677bd9cda4b33737c6 /modules | |
parent | 3a7047c670399f4dcd4033920004e1123edeec3e (diff) | |
download | brdo-56e1c5d106f9d1fa520c16803d812e7bca02e4b3.tar.gz brdo-56e1c5d106f9d1fa520c16803d812e7bca02e4b3.tar.bz2 |
- Patch #401922 by Damien Tournoud: fixed parent link detection.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/tests/menu.test | 12 | ||||
-rw-r--r-- | modules/simpletest/tests/menu_test.module | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test index a4935c968..633945cfc 100644 --- a/modules/simpletest/tests/menu.test +++ b/modules/simpletest/tests/menu.test @@ -47,6 +47,18 @@ class MenuIncTestCase extends DrupalWebTestCase { $name = db_result(db_query($sql)); $this->assertEqual($name, 'changed', t('Menu name was successfully changed after rebuild.')); } + + /** + * Tests for menu hiearchy. + */ + function testMenuHiearchy() { + $parent_link = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(':link_path' => 'menu-test/hierarchy/parent'))->fetchAssoc(); + $child_link = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(':link_path' => 'menu-test/hierarchy/parent/child'))->fetchAssoc(); + $unattached_child_link = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(':link_path' => 'menu-test/hierarchy/parent/child2/child'))->fetchAssoc(); + + $this->assertEqual($child_link['plid'], $parent_link['mlid'], t('The parent of a directly attached child is correct.')); + $this->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], t('The parent of a non-directly attached child is correct.')); + } } /** diff --git a/modules/simpletest/tests/menu_test.module b/modules/simpletest/tests/menu_test.module index 7a25f6aff..7bb5af5e5 100644 --- a/modules/simpletest/tests/menu_test.module +++ b/modules/simpletest/tests/menu_test.module @@ -24,6 +24,20 @@ function menu_test_menu() { 'page callback' => 'menu_test_callback', 'access arguments' => array('access content'), ); + + // Hierarchical tests. + $items['menu-test/hierarchy/parent'] = array( + 'title' => 'Parent menu router', + 'page callback' => 'node_page_default', + ); + $items['menu-test/hierarchy/parent/child'] = array( + 'title' => 'Child menu router', + 'page callback' => 'node_page_default', + ); + $items['menu-test/hierarchy/parent/child2/child'] = array( + 'title' => 'Unattached subchild router', + 'page callback' => 'node_page_default', + ); return $items; } |