Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.38
diff -u -r1.38 simpletest.module
--- modules/simpletest/simpletest.module	22 Feb 2009 17:55:30 -0000	1.38
+++ modules/simpletest/simpletest.module	30 Mar 2009 21:11:11 -0000
@@ -89,7 +89,8 @@
     $header = array(t('Message'), t('Group'), t('Filename'), t('Line'), t('Function'), array('colspan' => 2, 'data' => t('Status')));
     while ($result = db_fetch_object($results)) {
       $class = $result->test_class;
-      $info = $uncategorized_tests[$class]->getInfo();
+      $method = new ReflectionMethod($class, 'getInfo');
+      $info = $method->invoke(NULL);
       $group = $info['group'];
       $selected_tests[$group][$class] = TRUE;
       if (!isset($group_summary[$group])) {
@@ -130,7 +131,8 @@
     foreach ($form['results'] as $group => &$elements) {
       $group_ok = TRUE;
       foreach ($elements as $class => &$element) {
-        $info = $uncategorized_tests[$class]->getInfo();
+        $method = new ReflectionMethod($class, 'getInfo');
+        $info = $method->invoke(NULL);;
         $ok = $element['summary']['#fail'] + $element['summary']['#exception'] == 0;
         $element += array(
           '#type' => 'fieldset',
@@ -166,15 +168,13 @@
     $form['tests']['table'][$group_name] = array(
       '#collapsed' => TRUE,
     );
-    foreach ($test_group as $test) {
-      $test_info = $test->getInfo();
-      $test_class = get_class($test);
-      $is_selected = isset($selected_tests[$group_name][$test_class]);
-      $form['tests']['table'][$group_name][$test_class] = array(
+    foreach ($test_group as $class => $info) {
+      $is_selected = isset($selected_tests[$group_name][$class]);
+      $form['tests']['table'][$group_name][$class] = array(
         '#type' => 'checkbox',
-        '#title' => $test_info['name'],
+        '#title' => $info['name'],
         '#default_value' => $is_selected,
-        '#description' => $test_info['description'],
+        '#description' => $info['description'],
       );
       if ($is_selected) {
         $form['tests']['table'][$group_name]['#collapsed'] = FALSE;
@@ -475,18 +475,17 @@
       include_once DRUPAL_ROOT . '/' . $file;
     }
     $classes = array_values(array_diff(get_declared_classes(), $existing_classes));
-    $formatted_classes = array();
     foreach ($classes as $key => $class) {
-      if (method_exists($class, 'getInfo')) {
-        $formatted_classes[$class] = new $class;
+      if (!method_exists($class, 'getInfo')) {
+        unset($classes[$key]);
       }
     }
   }
-  if (count($formatted_classes) == 0) {
+  if (count($classes) == 0) {
     drupal_set_message('No test cases found.', 'error');
     return FALSE;
   }
-  return $formatted_classes;
+  return $classes;
 }
 
 /**
@@ -498,9 +497,10 @@
  */
 function simpletest_categorize_tests($tests) {
   $groups = array();
-  foreach ($tests as $test => $instance) {
-    $info = $instance->getInfo();
-    $groups[$info['group']][$test] = $instance;
+  foreach ($tests as $test) {
+    $method = new ReflectionMethod($test, 'getInfo');
+    $info = $method->invoke(NULL);
+    $groups[$info['group']][$test] = $info;
   }
   uksort($groups, 'strnatcasecmp');
   return $groups;
