Index: modules/aggregator/aggregator.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.info,v
retrieving revision 1.11
diff -u -r1.11 aggregator.info
--- modules/aggregator/aggregator.info	15 Mar 2009 18:59:05 -0000	1.11
+++ modules/aggregator/aggregator.info	1 Jun 2009 04:29:00 -0000
@@ -11,3 +11,4 @@
 files[] = aggregator.parser.inc
 files[] = aggregator.processor.inc
 files[] = aggregator.install
+files[] = aggregator.test
Index: modules/help/help.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/help/help.info,v
retrieving revision 1.7
diff -u -r1.7 help.info
--- modules/help/help.info	11 Oct 2008 02:32:47 -0000	1.7
+++ modules/help/help.info	1 Jun 2009 04:29:00 -0000
@@ -6,3 +6,4 @@
 core = 7.x
 files[] = help.module
 files[] = help.admin.inc
+files[] = help.test
Index: modules/node/node.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.info,v
retrieving revision 1.10
diff -u -r1.10 node.info
--- modules/node/node.info	12 Oct 2008 01:23:04 -0000	1.10
+++ modules/node/node.info	1 Jun 2009 04:29:00 -0000
@@ -9,4 +9,5 @@
 files[] = node.admin.inc
 files[] = node.pages.inc
 files[] = node.install
+files[] = node.test
 required = TRUE
Index: modules/upload/upload.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.info,v
retrieving revision 1.8
diff -u -r1.8 upload.info
--- modules/upload/upload.info	11 Oct 2008 02:33:13 -0000	1.8
+++ modules/upload/upload.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 files[] = upload.module
 files[] = upload.admin.inc
 files[] = upload.install
+files[] = upload.test
Index: modules/menu/menu.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.info,v
retrieving revision 1.8
diff -u -r1.8 menu.info
--- modules/menu/menu.info	11 Oct 2008 02:32:50 -0000	1.8
+++ modules/menu/menu.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 files[] = menu.module
 files[] = menu.admin.inc
 files[] = menu.install
+files[] = menu.test
Index: modules/locale/locale.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.info,v
retrieving revision 1.10
diff -u -r1.10 locale.info
--- modules/locale/locale.info	11 Oct 2008 02:32:49 -0000	1.10
+++ modules/locale/locale.info	1 Jun 2009 04:29:00 -0000
@@ -6,3 +6,4 @@
 core = 7.x
 files[] = locale.module
 files[] = locale.install
+files[] = locale.test
Index: modules/contact/contact.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.info,v
retrieving revision 1.8
diff -u -r1.8 contact.info
--- modules/contact/contact.info	11 Oct 2008 02:32:42 -0000	1.8
+++ modules/contact/contact.info	1 Jun 2009 04:29:00 -0000
@@ -8,3 +8,4 @@
 files[] = contact.admin.inc
 files[] = contact.pages.inc
 files[] = contact.install
+files[] = contact.test
Index: modules/php/php.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.info,v
retrieving revision 1.6
diff -u -r1.6 php.info
--- modules/php/php.info	11 Oct 2008 02:32:56 -0000	1.6
+++ modules/php/php.info	1 Jun 2009 04:29:00 -0000
@@ -6,3 +6,4 @@
 core = 7.x
 files[] = php.module
 files[] = php.install
+files[] = php.test
Index: modules/tracker/tracker.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.info,v
retrieving revision 1.8
diff -u -r1.8 tracker.info
--- modules/tracker/tracker.info	11 Oct 2008 02:33:07 -0000	1.8
+++ modules/tracker/tracker.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 core = 7.x
 files[] = tracker.module
 files[] = tracker.pages.inc
+files[] = tracker.test
Index: modules/block/block.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.info,v
retrieving revision 1.12
diff -u -r1.12 block.info
--- modules/block/block.info	3 Feb 2009 12:30:14 -0000	1.12
+++ modules/block/block.info	1 Jun 2009 04:29:00 -0000
@@ -8,3 +8,4 @@
 files[] = block.module
 files[] = block.admin.inc
 files[] = block.install
+files[] = block.test
Index: modules/comment/comment.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.info,v
retrieving revision 1.9
diff -u -r1.9 comment.info
--- modules/comment/comment.info	11 Oct 2008 02:32:41 -0000	1.9
+++ modules/comment/comment.info	1 Jun 2009 04:29:00 -0000
@@ -9,3 +9,4 @@
 files[] = comment.admin.inc
 files[] = comment.pages.inc
 files[] = comment.install
+files[] = comment.test
Index: modules/system/system.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.info,v
retrieving revision 1.12
diff -u -r1.12 system.info
--- modules/system/system.info	6 May 2009 10:37:28 -0000	1.12
+++ modules/system/system.info	1 Jun 2009 04:29:00 -0000
@@ -9,4 +9,5 @@
 files[] = system.queue.inc
 files[] = image.gd.inc
 files[] = system.install
+files[] = system.test
 required = TRUE
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.38
diff -u -r1.38 system.api.php
--- modules/system/system.api.php	24 May 2009 17:39:34 -0000	1.38
+++ modules/system/system.api.php	1 Jun 2009 04:29:00 -0000
@@ -1701,5 +1701,55 @@
 }
 
 /**
+ * Perform necessary alterations to the list of files parsed by the registry.
+ *
+ * Modules can manually modify the list of files before the registry parses
+ * them. The $module_cache provides the .info file information, which includes
+ * the list of files registered to the module. Any files in the list can then
+ * be added to the list of files that the registry will parse, or modify
+ * attributes of a file.
+ *
+ * File provided by disabled modules can be forced into the list of files the
+ * registry parses.
+ *
+ * @param $files
+ *   List of files to be parsed by the registry. The list will contain a file
+ *   found in each enabled module's info file and the includes directory. The
+ *   array is keyed by the file path and contains an array of the related module
+ *   name and weight.
+ *
+ *   For example:
+ *   @code
+ *     $files["modules/system/system.module"] = array(
+ *       'module' => 'system',
+ *       'weight' => 0,
+ *     );
+ *   @endcode
+ * @param $module_cache
+ *   List of all the files provided by modules in the system, as returned by
+ *   module_rebuild_cache(). The module object contains an property, 'dir',
+ *   added by _registry_rebuild(). The example shows how to take advantage of
+ *   the property.
+ *
+ * @see _registry_rebuild()
+ * @see module_rebuild_cache()
+ * @see simpletest_test_get_all()
+ */
+function hook_registry_files_alter($files, $module_cache) {
+  foreach ($module_cache as $module) {
+    // Only add test files for disabled modules, as enabled modules should
+    // already include any test files they provide.
+    if (!$module->status) {
+      $dir = $module->dir;
+      foreach ($module->info['files'] as $file) {
+        if (preg_match('/.*?\.test/', $file)) {
+          $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
+        }
+      }
+    }
+  }
+}
+
+/**
  * @} End of "addtogroup hooks".
  */
Index: scripts/run-tests.sh
===================================================================
RCS file: /cvs/drupal/drupal/scripts/run-tests.sh,v
retrieving revision 1.26
diff -u -r1.26 run-tests.sh
--- scripts/run-tests.sh	13 Apr 2009 12:23:26 -0000	1.26
+++ scripts/run-tests.sh	1 Jun 2009 04:29:00 -0000
@@ -44,8 +44,11 @@
 }
 
 // Load SimpleTest files.
-$all_tests = simpletest_get_all_tests();
-$groups = simpletest_categorize_tests($all_tests);
+$groups = simpletest_test_get_all();
+$all_tests = array();
+foreach ($groups as $group => $tests) {
+  $all_tests = array_merge($all_tests, array_keys($tests));
+}
 $test_list = array();
 
 if ($args['list']) {
@@ -54,8 +57,8 @@
   echo   "-------------------------------\n\n";
   foreach ($groups as $group => $tests) {
     echo $group . "\n";
-    foreach ($tests as $class_name => $info) {
-      echo " - " . $info['name'] . ' (' . $class_name . ')' . "\n";
+    foreach ($tests as $class => $info) {
+      echo " - " . $info['name'] . ' (' . $class . ')' . "\n";
     }
   }
   exit;
@@ -339,7 +342,6 @@
  * Run a single test (assume a Drupal bootstrapped environment).
  */
 function simpletest_script_run_one_test($test_id, $test_class) {
-  simpletest_get_all_tests();
   $test = new $test_class($test_id);
   $test->run();
   $info = $test->getInfo();
Index: modules/user/user.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.info,v
retrieving revision 1.10
diff -u -r1.10 user.info
--- modules/user/user.info	12 Oct 2008 01:23:07 -0000	1.10
+++ modules/user/user.info	1 Jun 2009 04:29:00 -0000
@@ -8,4 +8,5 @@
 files[] = user.admin.inc
 files[] = user.pages.inc
 files[] = user.install
+files[] = user.test
 required = TRUE
Index: modules/field/modules/text/text.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.info,v
retrieving revision 1.3
diff -u -r1.3 text.info
--- modules/field/modules/text/text.info	10 May 2009 18:56:57 -0000	1.3
+++ modules/field/modules/text/text.info	1 Jun 2009 04:29:00 -0000
@@ -4,4 +4,5 @@
 package = Core - fields
 version = VERSION
 core = 7.x
-files[]=text.module
+files[] = text.module
+files[] = text.test
Index: modules/blogapi/blogapi.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.info,v
retrieving revision 1.9
diff -u -r1.9 blogapi.info
--- modules/blogapi/blogapi.info	11 Oct 2008 02:32:37 -0000	1.9
+++ modules/blogapi/blogapi.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 core = 7.x
 files[] = blogapi.module
 files[] = blogapi.install
+files[] = blogapi.test
Index: modules/dblog/dblog.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.info,v
retrieving revision 1.6
diff -u -r1.6 dblog.info
--- modules/dblog/dblog.info	11 Oct 2008 02:32:44 -0000	1.6
+++ modules/dblog/dblog.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 files[] = dblog.module
 files[] = dblog.admin.inc
 files[] = dblog.install
+files[] = dblog.test
Index: modules/taxonomy/taxonomy.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.info,v
retrieving revision 1.8
diff -u -r1.8 taxonomy.info
--- modules/taxonomy/taxonomy.info	11 Oct 2008 02:33:06 -0000	1.8
+++ modules/taxonomy/taxonomy.info	1 Jun 2009 04:29:00 -0000
@@ -8,3 +8,4 @@
 files[] = taxonomy.admin.inc
 files[] = taxonomy.pages.inc
 files[] = taxonomy.install
+files[] = taxonomy.test
Index: modules/profile/profile.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.info,v
retrieving revision 1.8
diff -u -r1.8 profile.info
--- modules/profile/profile.info	11 Oct 2008 02:32:59 -0000	1.8
+++ modules/profile/profile.info	1 Jun 2009 04:29:00 -0000
@@ -8,3 +8,4 @@
 files[] = profile.admin.inc
 files[] = profile.pages.inc
 files[] = profile.install
+files[] = profile.test
Index: modules/simpletest/simpletest.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.info,v
retrieving revision 1.5
diff -u -r1.5 simpletest.info
--- modules/simpletest/simpletest.info	1 May 2009 11:01:53 -0000	1.5
+++ modules/simpletest/simpletest.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,26 @@
 files[] = simpletest.module
 files[] = simpletest.pages.inc
 files[] = simpletest.install
+files[] = simpletest.test
+files[] = drupal_web_test_case.php
+
+; Tests in tests directory.
+files[] = tests/actions.test
+files[] = tests/batch.test
+files[] = tests/bootstrap.test
+files[] = tests/cache.test
+files[] = tests/common.test
+files[] = tests/database_test.test
+files[] = tests/error.test
+files[] = tests/file.test
+files[] = tests/form.test
+files[] = tests/graph.test
+files[] = tests/image.test
+files[] = tests/menu.test
+files[] = tests/module.test
+files[] = tests/registry.test
+files[] = tests/schema.test
+files[] = tests/session.test
+files[] = tests/theme.test
+files[] = tests/unicode.test
+files[] = tests/xmlrpc.test
Index: modules/simpletest/simpletest.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.pages.inc,v
retrieving revision 1.2
diff -u -r1.2 simpletest.pages.inc
--- modules/simpletest/simpletest.pages.inc	24 May 2009 17:39:34 -0000	1.2
+++ modules/simpletest/simpletest.pages.inc	1 Jun 2009 04:29:00 -0000
@@ -12,10 +12,6 @@
 function simpletest_test_form() {
   $form = array();
 
-  // Categorize the tests for display.
-  $uncategorized_tests = simpletest_get_all_tests();
-  $tests = simpletest_categorize_tests($uncategorized_tests);
-
   $form['tests'] = array(
     '#type' => 'fieldset',
     '#title' => t('Tests'),
@@ -27,13 +23,14 @@
   );
 
   // Generate the list of tests arranged by group.
-  foreach ($tests as $group_name => $test_group) {
-    $form['tests']['table'][$group_name] = array(
+  $groups = simpletest_test_get_all();
+  foreach ($groups as $group => $tests) {
+    $form['tests']['table'][$group] = array(
       '#collapsed' => TRUE,
     );
 
-    foreach ($test_group as $class => $info) {
-      $form['tests']['table'][$group_name][$class] = array(
+    foreach ($tests as $class => $info) {
+      $form['tests']['table'][$group][$class] = array(
         '#type' => 'checkbox',
         '#title' => $info['name'],
         '#description' => $info['description'],
@@ -166,9 +163,6 @@
  * Run selected tests.
  */
 function simpletest_test_form_submit($form, &$form_state) {
-  // Ensure that all classes are loaded before we create instances to get test information and run.
-  simpletest_get_all_tests();
-
   // Get list of tests.
   $tests_list = array();
   foreach ($form_state['values'] as $class_name => $value) {
@@ -200,7 +194,6 @@
 
   // Load all classes and include CSS.
   drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css');
-  simpletest_get_all_tests();
 
   // Keep track of which test cases passed or failed.
   $filter = array(
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.52
diff -u -r1.52 simpletest.module
--- modules/simpletest/simpletest.module	30 May 2009 11:17:32 -0000	1.52
+++ modules/simpletest/simpletest.module	1 Jun 2009 04:29:00 -0000
@@ -139,9 +139,6 @@
  * Batch operation callback.
  */
 function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
-  // Ensure that all classes are loaded before we unserialize some instances.
-  simpletest_get_all_tests();
-
   // Get working values.
   if (!isset($context['sandbox']['max'])) {
     // First iteration: initialize working values.
@@ -200,65 +197,83 @@
 }
 
 /**
- * Get a list of all of the tests.
+ * Get a list of all of the registered tests.
+ *
+ * The list of test classes is loaded from the registry where is looks for
+ * files ending in ".test". Once loaded the test list is cached and stored in
+ * a static variable.
  *
  * @return
- *   An array of tests, with the class name as the keys and the instantiated
- *   versions of the classes as the values.
+ *   An array of tests keyed with the groups specified in each of the tests
+ *   getInfo() array and then by the test class.
  */
-function simpletest_get_all_tests() {
-  static $classes;
-  if (!isset($classes)) {
-    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'simpletest') . '/drupal_web_test_case.php';
-    $files = array();
-    foreach (array_keys(module_rebuild_cache()) as $module) {
-      $module_path = drupal_get_path('module', $module);
-      $test = $module_path . "/$module.test";
-      if (file_exists($test)) {
-        $files[] = $test;
-      }
+function simpletest_test_get_all() {
+  $groups = &drupal_static(__FUNCTION__);
+
+  if (!$groups) {
+    // Load test information from cache if available, otherwise retrieve the
+    // information from each tests getInfo() method.
+    if ($cache = cache_get('simpletest', 'cache')) {
+      $groups = $cache->data;
+    }
+    else {
+      // Select all clases in files ending with .test.
+      $classes = db_select('registry')
+        ->fields('registry', array('name'))
+        ->condition('type', 'class')
+        ->condition('filename', '%.test', 'LIKE')
+        ->execute();
+
+      $groups = array();
+
+      // Check that each class has a getInfo() method and store the information
+      // in an array keyed with the group specified in the test information.
+      foreach ($classes as $class) {
+        $class = $class->name;
+        if (class_exists($class) && method_exists($class, 'getInfo')) {
+          // Valid test class, retrieve test information.
+          $info = call_user_func(array($class, 'getInfo'));
+
+          // Initialize test groups.
+          if (!isset($groups[$info['group']])) {
+            $groups[$info['group']] = array();
+          }
 
-      $tests_directory = $module_path . '/tests';
-      if (is_dir($tests_directory)) {
-        foreach (file_scan_directory($tests_directory, '/\.test$/') as $file) {
-          $files[] = $file->filepath;
+          $groups[$info['group']][$class] = $info;
         }
       }
-    }
 
-    $existing_classes = get_declared_classes();
-    foreach ($files as $file) {
-      include_once DRUPAL_ROOT . '/' . $file;
-    }
-    $classes = array_values(array_diff(get_declared_classes(), $existing_classes));
-    foreach ($classes as $key => $class) {
-      if (!is_subclass_of($class, 'DrupalTestCase') || !method_exists($class, 'getInfo')) {
-        unset($classes[$key]);
+      // Sort the groups and tests within the groups by name.
+      uksort($groups, 'strnatcasecmp');
+      foreach ($groups as $group => &$tests) {
+        uksort($tests, 'strnatcasecmp');
       }
+
+      cache_set('simpletest', $groups);
     }
   }
-  if (count($classes) == 0) {
-    drupal_set_message('No test cases found.', 'error');
-    return FALSE;
-  }
-  return $classes;
+  return $groups;
 }
 
 /**
- * Categorize the tests into groups.
+ * Implementation of hook_registry_files_alter().
  *
- * @param $tests
- *   A list of tests from simpletest_get_all_tests.
- * @see simpletest_get_all_tests.
- */
-function simpletest_categorize_tests($tests) {
-  $groups = array();
-  foreach ($tests as $test) {
-    $info = call_user_func(array($test, 'getInfo'));
-    $groups[$info['group']][$test] = $info;
+ * Add the test files for disabled modules so that we get a list containing
+ * all the avialable tests.
+ */
+function simpletest_registry_files_alter($files, $module_cache) {
+  foreach ($module_cache as $module) {
+    // Only add test files for disabled modules, as enabled modules should
+    // already include any test files they provide.
+    if (!$module->status) {
+      $dir = $module->dir;
+      foreach ($module->info['files'] as $file) {
+        if (preg_match('/.*?\.test/', $file)) {
+          $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
+        }
+      }
+    }
   }
-  uksort($groups, 'strnatcasecmp');
-  return $groups;
 }
 
 /**
Index: modules/blog/blog.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.info,v
retrieving revision 1.10
diff -u -r1.10 blog.info
--- modules/blog/blog.info	11 Oct 2008 02:32:36 -0000	1.10
+++ modules/blog/blog.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 core = 7.x
 files[] = blog.module
 files[] = blog.pages.inc
+files[] = blog.test
Index: modules/forum/forum.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.info,v
retrieving revision 1.11
diff -u -r1.11 forum.info
--- modules/forum/forum.info	11 Oct 2008 02:32:46 -0000	1.11
+++ modules/forum/forum.info	1 Jun 2009 04:29:00 -0000
@@ -10,3 +10,4 @@
 files[] = forum.admin.inc
 files[] = forum.pages.inc
 files[] = forum.install
+files[] = forum.test
Index: modules/path/path.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.info,v
retrieving revision 1.7
diff -u -r1.7 path.info
--- modules/path/path.info	11 Oct 2008 02:32:54 -0000	1.7
+++ modules/path/path.info	1 Jun 2009 04:29:00 -0000
@@ -6,3 +6,4 @@
 core = 7.x
 files[] = path.module
 files[] = path.admin.inc
+files[] = path.test
Index: modules/statistics/statistics.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.info,v
retrieving revision 1.8
diff -u -r1.8 statistics.info
--- modules/statistics/statistics.info	11 Oct 2008 02:33:02 -0000	1.8
+++ modules/statistics/statistics.info	1 Jun 2009 04:29:00 -0000
@@ -8,3 +8,4 @@
 files[] = statistics.admin.inc
 files[] = statistics.pages.inc
 files[] = statistics.install
+files[] = statistics.test
Index: modules/poll/poll.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.info,v
retrieving revision 1.8
diff -u -r1.8 poll.info
--- modules/poll/poll.info	11 Oct 2008 02:32:57 -0000	1.8
+++ modules/poll/poll.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 files[] = poll.module
 files[] = poll.pages.inc
 files[] = poll.install
+files[] = poll.test
Index: modules/trigger/trigger.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.info,v
retrieving revision 1.5
diff -u -r1.5 trigger.info
--- modules/trigger/trigger.info	11 Oct 2008 02:33:10 -0000	1.5
+++ modules/trigger/trigger.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 files[] = trigger.module
 files[] = trigger.admin.inc
 files[] = trigger.install
+files[] = trigger.test
Index: modules/field/field.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.info,v
retrieving revision 1.2
diff -u -r1.2 field.info
--- modules/field/field.info	10 May 2009 18:56:56 -0000	1.2
+++ modules/field/field.info	1 Jun 2009 04:29:00 -0000
@@ -12,5 +12,6 @@
 files[] = field.attach.inc
 files[] = field.form.inc
 files[] = field.autoload.inc
+files[] = field.test
 dependencies[] = field_sql_storage
 required = TRUE
Index: modules/syslog/syslog.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/syslog/syslog.info,v
retrieving revision 1.5
diff -u -r1.5 syslog.info
--- modules/syslog/syslog.info	11 Oct 2008 02:33:03 -0000	1.5
+++ modules/syslog/syslog.info	1 Jun 2009 04:29:00 -0000
@@ -5,3 +5,4 @@
 version = VERSION
 core = 7.x
 files[] = syslog.module
+files[] = syslog.test
Index: modules/field/modules/field_sql_storage/field_sql_storage.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/field_sql_storage/field_sql_storage.info,v
retrieving revision 1.2
diff -u -r1.2 field_sql_storage.info
--- modules/field/modules/field_sql_storage/field_sql_storage.info	10 May 2009 18:56:56 -0000	1.2
+++ modules/field/modules/field_sql_storage/field_sql_storage.info	1 Jun 2009 04:29:00 -0000
@@ -6,4 +6,5 @@
 core = 7.x
 files[] = field_sql_storage.module
 files[] = field_sql_storage.install
+files[] = field_sql_storage.test
 required = TRUE
Index: includes/registry.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/registry.inc,v
retrieving revision 1.16
diff -u -r1.16 registry.inc
--- includes/registry.inc	16 May 2009 16:04:42 -0000	1.16
+++ includes/registry.inc	1 Jun 2009 04:29:00 -0000
@@ -45,11 +45,19 @@
   system_get_files_database($modules, 'module');
   // Get the list of files we are going to parse.
   $files = array();
-  foreach ($modules as $module) {
+  $module_cache = module_rebuild_cache();
+  foreach ($module_cache as $module) {
+    $dir = dirname($module->filepath);
+
+    // Store the module directory for use in hook_registry_files_alter().
+    $module_cache[$module->name]->dir = $dir;
+
+    // Parse .info file only for all modules. The list of files can then be
+    // used in hook_registry_files_alter() implementations.
+    $module->info = drupal_parse_info_file(dirname($module->filepath) . '/' . $module->name . '.info');
+
     if ($module->status) {
-      // Parse .info file only for enabled modules.
-      $module->info = drupal_parse_info_file(dirname($module->filepath) . '/' . $module->name . '.info');
-      $dir = dirname($module->filepath);
+      // Add enabled modules files to registry.
       foreach ($module->info['files'] as $file) {
         $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
       }
@@ -59,6 +67,13 @@
     $files["$filename"] = array('module' => '', 'weight' => 0);
   }
 
+  // Allow modules to manually modify the list of files before the registry
+  // parses them. The $module_cache provides the .info file information, which
+  // includes the list of files registered to the module. Any files in the list
+  // can then be added to the list of files that the registry will parse, or
+  // modify attributes of a file.
+  drupal_alter('registry_files', $files, $module_cache);
+
   foreach (registry_get_parsed_files() as $filename => $file) {
     // Add the md5 to those files we've already parsed.
     if (isset($files[$filename])) {
Index: modules/translation/translation.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.info,v
retrieving revision 1.4
diff -u -r1.4 translation.info
--- modules/translation/translation.info	11 Oct 2008 02:33:09 -0000	1.4
+++ modules/translation/translation.info	1 Jun 2009 04:29:00 -0000
@@ -7,3 +7,4 @@
 core = 7.x
 files[] = translation.module
 files[] = translation.pages.inc
+files[] = translation.test
Index: modules/filter/filter.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.info,v
retrieving revision 1.11
diff -u -r1.11 filter.info
--- modules/filter/filter.info	12 Oct 2008 01:23:03 -0000	1.11
+++ modules/filter/filter.info	1 Jun 2009 04:29:00 -0000
@@ -8,4 +8,5 @@
 files[] = filter.admin.inc
 files[] = filter.pages.inc
 files[] = filter.install
+files[] = filter.test
 required = TRUE
Index: modules/book/book.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.info,v
retrieving revision 1.11
diff -u -r1.11 book.info
--- modules/book/book.info	13 Oct 2008 19:59:41 -0000	1.11
+++ modules/book/book.info	1 Jun 2009 04:29:00 -0000
@@ -9,3 +9,4 @@
 files[] = book.admin.inc
 files[] = book.pages.inc
 files[] = book.install
+files[] = book.test
Index: modules/openid/openid.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.info,v
retrieving revision 1.6
diff -u -r1.6 openid.info
--- modules/openid/openid.info	11 Oct 2008 02:32:53 -0000	1.6
+++ modules/openid/openid.info	1 Jun 2009 04:29:00 -0000
@@ -9,3 +9,4 @@
 files[] = openid.pages.inc
 files[] = xrds.inc
 files[] = openid.install
+files[] = openid.test
