? common.inc_documentation-232931-2.patch
? drupal.node-permissions_39.patch
? help.test_0.patch
? menu_rebuild_needed_test.patch
? node.test-cleanup_1.patch
? node.test-cleanup_2.patch
? reset.php
? simpletest-check-all_3.patch
? simpletest_field_byxpath_2.patch
? sites/default/files
? sites/default/settings.php
Index: modules/simpletest/tests/menu.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v
retrieving revision 1.2
diff -u -p -r1.2 menu.test
--- modules/simpletest/tests/menu.test	15 Sep 2008 20:48:09 -0000	1.2
+++ modules/simpletest/tests/menu.test	12 Oct 2008 02:07:16 -0000
@@ -45,3 +45,42 @@ class MenuIncTestCase extends DrupalWebT
     $this->assertEqual($name, 'changed', t('Menu name was successfully changed after rebuild.'));
   }
 }
+
+class MenuRebuildCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Menu rebuild test'),
+      'description' => t('Test rebuilding of menu.'),
+      'group' => t('Menu'),
+    );
+  }
+  
+  /**
+   * Test if the 'menu_rebuild_needed' variable triggers
+   * an menu_rebuild() call.
+   */
+  function testMenuRebuildByVariable() {
+    // Check if 'admin' exists
+    $adminexists = db_result(db_query("SELECT path from {menu_router} WHERE path='admin'"));
+    $this->assertEqual($adminexists, 'admin', t("The path 'admin/' exists prior to deleting."));
+    
+    // Delete the path item 'admin', and test that the path doesn't exist in the database.
+    $delete =  db_delete('menu_router')
+      ->condition('path', 'admin')
+      ->execute();
+    
+    $adminexists = db_result(db_query("SELECT path from {menu_router} WHERE path='admin'"));
+    $this->assertFalse($adminexists, t("The path 'admin/' has been deleted and doesn't exist in the database."));
+    
+    // Now we enable the rebuild variable and trigger menu_execute_active_handler()
+    // to rebuild the menu item. Now 'admin' should exist.
+    variable_set('menu_rebuild_needed', TRUE);
+    $this->drupalGet('<front>');// menu_execute_active_handler() should trigger the rebuild.
+    $adminexists = db_result(db_query("SELECT path from {menu_router} WHERE path='admin'"));
+    $this->assertEqual($adminexists, 'admin', t("The menu has been rebuilt, the path 'admin' now exists again."));
+  }
+  
+}
\ No newline at end of file
