Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules//simpletest/simpletest.module,v
retrieving revision 1.52
diff -u -p -r1.52 simpletest.module
--- modules/simpletest/simpletest.module	30 May 2009 11:17:32 -0000	1.52
+++ modules/simpletest/simpletest.module	4 Jun 2009 00:30:39 -0000
@@ -207,7 +207,7 @@ function _simpletest_batch_finished($suc
  *   versions of the classes as the values.
  */
 function simpletest_get_all_tests() {
-  static $classes;
+  $classes = &drupal_static(__FUNCTION__);
   if (!isset($classes)) {
     require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'simpletest') . '/drupal_web_test_case.php';
     $files = array();
Index: modules/simpletest/simpletest.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules//simpletest/simpletest.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 simpletest.pages.inc
--- modules/simpletest/simpletest.pages.inc	24 May 2009 17:39:34 -0000	1.2
+++ modules/simpletest/simpletest.pages.inc	4 Jun 2009 00:30:39 -0000
@@ -380,6 +380,7 @@ function simpletest_result_get($test_id)
  * @return HTML image or false.
  */
 function simpletest_result_status_image($status) {
+  // $map does not use drupal_static() as its value never changes.
   static $map;
 
   if (!isset($map)) {
Index: modules/simpletest/tests/file.test
===================================================================
RCS file: /cvs/drupal/drupal/modules//simpletest/tests/file.test,v
retrieving revision 1.32
diff -u -p -r1.32 file.test
--- modules/simpletest/tests/file.test	2 Jun 2009 13:42:40 -0000	1.32
+++ modules/simpletest/tests/file.test	4 Jun 2009 00:30:39 -0000
@@ -18,26 +18,28 @@ function file_test_validator($file, $err
  * Helper function for testing file_scan_directory().
  *
  * Each time the function is called the file is stored in a static variable.
- * When the function is called with $reset parameter TRUE the cache is cleared
- * and the results returned.
+ * When the function is called with no $filepath parameter, the results are
+ * returned.
  *
  * @param $filepath
  *   File path
- * @param $reset
- *   Boolean indicating that the stored files should be removed and returned.
  * @return
- *   An array of all previous $file parameters since $reset was last called.
+ *   If $filepath is NULL, an array of all previous $filepath parameters
  */
-function file_test_file_scan_callback($filepath, $reset = FALSE) {
-  static $files = array();
-
-  if ($reset) {
-    $ret = $files;
-    $files = array();
-    return $ret;
+function file_test_file_scan_callback($filepath == NULL) {
+  $files = &drupal_static(__FUNCTION__, array());
+  if (isset($filepath)) {
+    $files[] = $filepath;
+  } else {
+    return files;
   }
+}
 
-  $files[] = $filepath;
+/**
+ * Reset static variables used by file_test_file_scan_callback().
+ */
+function file_test_file_scan_callback_reset() {
+  drupal_static_reset('file_test_file_scan_callback');
 }
 
 /**
@@ -869,14 +871,16 @@ class FileScanDirectoryTest extends File
     // When nothing is matched nothing should be passed to the callback.
     $all_files = file_scan_directory($this->path, '/^NONEXISTINGFILENAME/', array('callback' => 'file_test_file_scan_callback'));
     $this->assertEqual(0, count($all_files), t('No files were found.'));
-    $results = file_test_file_scan_callback(NULL, TRUE);
+    $results = file_test_file_scan_callback();
+    file_test_file_scan_callback_reset();
     $this->assertEqual(0, count($results), t('No files were passed to the callback.'));
 
     // Grab a listing of all the JavaSscript files and check that they're
     // passed to the callback.
     $all_files = file_scan_directory($this->path, '/^javascript-/', array('callback' => 'file_test_file_scan_callback'));
     $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.'));
-    $results = file_test_file_scan_callback(NULL, TRUE);
+    $results = file_test_file_scan_callback();
+    file_test_file_scan_callback_reset();
     $this->assertEqual(2, count($results), t('Files were passed to the callback.'));
   }
 
