Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.227
diff -u -r1.227 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	27 Aug 2010 12:36:53 -0000	1.227
+++ modules/simpletest/drupal_web_test_case.php	27 Aug 2010 21:32:46 -0000
@@ -1227,19 +1227,8 @@
       module_enable(array($this->profile), FALSE);
     }
 
-    // Rebuild caches.
-    drupal_static_reset();
-    drupal_flush_all_caches();
-
-    // Register actions declared by any modules.
-    actions_synchronize();
-
-    // Reload global $conf array and permissions.
-    $this->refreshVariables();
-    $this->checkPermissions(array(), TRUE);
-
-    // Reset statically cached schema for new database prefix.
-    drupal_get_schema(NULL, TRUE);
+    // Reset/rebuild all data structures after enabling the modules.
+    $this->resetAll();
 
     // Run cron once in that environment, as install.php does at the end of
     // the installation process.
@@ -1277,6 +1266,27 @@
   }
 
   /**
+   * This method is called by DrupalWebTestCase::setUp() after enabling
+   * the requested modules. It must be called again when additional modules
+   * are enabled later.
+   */
+  protected function resetAll() {
+    // Rebuild caches.
+    drupal_static_reset();
+    drupal_flush_all_caches();
+
+    // Register actions declared by any modules.
+    actions_synchronize();
+
+    // Reload global $conf array and permissions.
+    $this->refreshVariables();
+    $this->checkPermissions(array(), TRUE);
+
+    // Reset statically cached schema for new database prefix.
+    drupal_get_schema(NULL, TRUE);
+  }
+
+  /**
    * Refresh the in-memory set of variables. Useful after a page request is made
    * that changes a variable in a different thread.
    *
