Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.179
diff -u -p -r1.179 module.inc
--- includes/module.inc	13 Jan 2010 05:08:29 -0000	1.179
+++ includes/module.inc	14 Jan 2010 21:17:56 -0000
@@ -291,12 +291,11 @@ function module_load_all_includes($type,
  *   If TRUE, dependencies will automatically be added and enabled in the
  *   correct order. This incurs a significant performance cost, so use FALSE
  *   if you know $module_list is already complete and in the correct order.
- * @param $disable_modules_installed_hook
- *   Normally just testing wants to set this to TRUE.
+ *
  * @return
  *   FALSE if one or more dependencies are missing, TRUE otherwise.
  */
-function module_enable($module_list, $enable_dependencies = TRUE, $disable_modules_installed_hook = FALSE) {
+function module_enable($module_list, $enable_dependencies = TRUE) {
   if ($enable_dependencies) {
     // Get all module data so we can find dependencies and sort.
     $module_data = system_rebuild_module_data();
@@ -368,7 +367,7 @@ function module_enable($module_list, $en
     drupal_get_schema(NULL, TRUE);
 
     // If any modules were newly installed, execute the hook for them.
-    if (!$disable_modules_installed_hook && !empty($modules_installed)) {
+    if (!empty($modules_installed)) {
       module_invoke_all('modules_installed', $modules_installed);
     }
     _system_update_bootstrap_status();
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.192
diff -u -p -r1.192 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	13 Jan 2010 06:10:43 -0000	1.192
+++ modules/simpletest/drupal_web_test_case.php	14 Jan 2010 21:20:40 -0000
@@ -1092,7 +1092,7 @@ class DrupalWebTestCase extends DrupalTe
    *   List of modules to enable for the duration of the test.
    */
   protected function setUp() {
-    global $db_prefix, $user, $language;
+    global $db_prefix, $user, $language, $conf;
 
     // Store necessary current values before switching to prefixed database.
     $this->originalLanguage = $language;
@@ -1127,8 +1127,10 @@ class DrupalWebTestCase extends DrupalTe
     ini_set('log_errors', 1);
     ini_set('error_log', $public_files_directory . '/error.log');
 
-    // Reset all statics so that test is performed with a clean environment.
+    // Reset all statics and variables, so tests are performed in a clean
+    // environment.
     drupal_static_reset();
+    $conf = array();
 
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
@@ -1140,32 +1142,34 @@ class DrupalWebTestCase extends DrupalTe
     $profile_details = install_profile_info('standard', 'en');
 
     // Install the modules specified by the default profile.
-    module_enable($profile_details['dependencies'], FALSE, TRUE);
-
-    drupal_static_reset('_node_types_build');
+    module_enable($profile_details['dependencies'], FALSE);
 
+    // Install modules needed for this test.
     if ($modules = func_get_args()) {
-      // Install modules needed for this test.
-      module_enable($modules, TRUE, TRUE);
+      module_enable($modules, TRUE);
     }
 
-    // Because the schema is static cached, we need to flush
-    // it between each run. If we don't, then it will contain
-    // stale data for the previous run's database prefix and all
-    // calls to it will fail.
-    drupal_get_schema(NULL, TRUE);
-
     // Run default profile tasks.
-    $install_state = array();
-    module_enable(array('standard'), FALSE, TRUE);
+    module_enable(array('standard'), FALSE);
 
     // Rebuild caches.
-    node_types_rebuild();
+    drupal_flush_all_caches();
+
+    // Register actions declared by any modules.
     actions_synchronize();
-    _drupal_flush_css_js();
+
+    // Reload global $conf array.
     $this->refreshVariables();
     $this->checkPermissions(array(), TRUE);
 
+    // Reset statically cached schema for new database prefix.
+    drupal_get_schema(NULL, TRUE);
+
+    // Run cron to populate update status tables (if available) so that users
+    // will be warned if they've installed an out of date Drupal version.
+    // Will also trigger indexing of profile-supplied content or feeds.
+    drupal_cron_run();
+
     // Log in with a clean $user.
     $this->originalUser = $user;
     drupal_save_session(FALSE);
