Fix for simpletest_get_all_tests

  1. /**
  2.  * Get a list of all of the tests.
  3.  *
  4.  * @return
  5.  *   An array of tests, with the test class name as the keys and the test
  6.  *   information as the value.
  7.  * @see hook_test()
  8.  */
  9. function simpletest_get_all_tests() {
  10.   static $tests;
  11.  
  12.   if (!isset($tests)) {
  13.     // Manually call each module so that we can know which module a given test
  14.     // came from.
  15.     $tests = array();
  16.     foreach (array_keys(module_rebuild_cache()) as $module) {
  17.       drupal_load('module', $module);
  18.       $function = $module . '_test';
  19.       if (function_exists($function)) {
  20.         $test_classes = $function();
  21.         if ($test_classes) {
  22.           foreach (array_keys($test_classes) as $test_class) {
  23.             $test_classes[$test_class]['module'] = $module;
  24.           }
  25.           $tests = array_merge($tests, $test_classes);
  26.         }
  27.       }
  28.     }
  29.   }
  30.  
  31.   return $tests;
  32. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.