? patches
Index: drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/drupal_web_test_case.php,v
retrieving revision 1.2.2.3.2.58
diff -u -p -r1.2.2.3.2.58 drupal_web_test_case.php
--- drupal_web_test_case.php	1 Dec 2010 05:48:50 -0000	1.2.2.3.2.58
+++ drupal_web_test_case.php	1 Dec 2010 06:49:39 -0000
@@ -2,6 +2,18 @@
 // $Id: drupal_web_test_case.php,v 1.2.2.3.2.58 2010/12/01 05:48:50 davereid Exp $
 
 /**
+ * Global variable that holds information about the tests being run.
+ *
+ * An array, with the following keys:
+ *  - 'test_run_id': the ID of the test being run, in the form 'simpletest_%"
+ *  - 'in_child_site': TRUE if the current request is a cURL request from
+ *     the parent site.
+ *
+ * @var array
+ */
+global $drupal_test_info;
+
+/**
  * Base class for Drupal tests.
  *
  * Do not extend this class, use one of the subclasses in this file.
@@ -22,6 +34,13 @@ abstract class DrupalTestCase {
   protected $originalPrefix = NULL;
 
   /**
+   * The database prefix of this test run.
+   *
+   * @var string
+   */
+  protected $databasePrefix = NULL;
+
+  /**
    * The original file directory, before it was changed for testing purposes.
    *
    * @var string
@@ -90,8 +109,6 @@ abstract class DrupalTestCase {
    *   is the caller function itself.
    */
   protected function assert($status, $message = '', $group = 'Other', array $caller = NULL) {
-    global $db_prefix;
-
     // Convert boolean status to string status.
     if (is_bool($status)) {
       $status = $status ? 'pass' : 'fail';
@@ -105,10 +122,6 @@ abstract class DrupalTestCase {
       $caller = $this->getAssertionCall();
     }
 
-    // Switch to non-testing database to store results in.
-    $current_db_prefix = $db_prefix;
-    $db_prefix = $this->originalPrefix;
-
     // Creation assertion array that can be displayed while tests are running.
     $this->assertions[] = $assertion = array(
       'test_id' => $this->testId,
@@ -122,15 +135,13 @@ abstract class DrupalTestCase {
     );
 
     // Store assertion for display after the test has completed.
-//    db_insert('simpletest')
-//      ->fields($assertion)
-//      ->execute();
+    $current_db_prefix = $GLOBALS['db_prefix'];
+    $GLOBALS['db_prefix'] = $this->originalPrefix;
     db_query("INSERT INTO {simpletest}
               (test_id, test_class, status, message, message_group, function, line, file)
               VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d, '%s')", array_values($assertion));
+    $GLOBALS['db_prefix'] = $current_db_prefix;
 
-    // Return to testing prefix.
-    $db_prefix = $current_db_prefix;
     // We do not use a ternary operator here to allow a breakpoint on
     // test failure.
     if ($status == 'pass') {
@@ -580,18 +591,31 @@ class DrupalUnitTestCase extends DrupalT
     $this->skipClasses[__CLASS__] = TRUE;
   }
 
-  function setUp() {
-    global $db_prefix, $conf;
+  /**
+   * Sets up unit test environment.
+   *
+   * Unlike DrupalWebTestCase::setUp(), DrupalUnitTestCase::setUp() does not
+   * install modules because tests are performed without accessing the database.
+   * Any required files must be explicitly included by the child class setUp()
+   * method.
+   */
+  protected function setUp() {
+    global $conf;
 
-    // Store necessary current values before switching to prefixed database.
-    $this->originalPrefix = $db_prefix;
-    $this->originalFileDirectory = file_directory_path();
+    // Store necessary current values before switching to the test environment.
+    $this->originalPrefix = $GLOBALS['db_prefix'];
+    $this->originalFileDirectory =  variable_get('file_directory_path', conf_path() . '/files');
 
     // Generate temporary prefixed database to ensure that tests have a clean starting point.
-//    $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');
-    $db_prefix = $db_prefix . 'simpletest' . mt_rand(1000, 1000000);
-//    $conf['file_public_path'] = $this->originalFileDirectory . '/' . $db_prefix;
-    $conf['file_directory_path'] = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10);
+    $this->databasePrefix = 'simpletest' . mt_rand(1000, 1000000);
+
+    // Create test directory.
+    $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10);
+    file_check_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+    $conf['file_directory_path'] = $public_files_directory;
+
+    // Clone the current connection and replace the current prefix.
+    $GLOBALS['db_prefix'] = is_array($GLOBALS['db_prefix']) ? $GLOBALS['db_prefix']['default'] : $GLOBALS['db_prefix'] . $this->databasePrefix;
 
     // If locale is enabled then t() will try to access the database and
     // subsequently will fail as the database is not accessible.
@@ -603,17 +627,16 @@ class DrupalUnitTestCase extends DrupalT
     }
   }
 
-  function tearDown() {
-    global $db_prefix, $conf;
-    if (preg_match('/simpletest\d+/', $db_prefix)) {
-//      $conf['file_public_path'] = $this->originalFileDirectory;
-      $conf['file_directory_path'] = $this->originalFileDirectory;
-      // Return the database prefix to the original.
-      $db_prefix = $this->originalPrefix;
-      // Restore modules if necessary.
-      if (isset($this->originalModuleList)) {
-        module_list(TRUE, FALSE, FALSE, $this->originalModuleList);
-      }
+  protected function tearDown() {
+    global $conf;
+
+    // Get back to the original connection.
+    $GLOBALS['db_prefix'] = $this->originalPrefix;
+
+    $conf['file_directory_path'] = $this->originalFileDirectory;
+    // Restore modules if necessary.
+    if (isset($this->originalModuleList)) {
+      module_list(TRUE, FALSE, FALSE, $this->originalModuleList);
     }
   }
 }
@@ -728,6 +751,11 @@ class DrupalWebTestCase extends DrupalTe
   protected $session_id = NULL;
 
   /**
+   * Whether the files were copied to the test files directory.
+   */
+  protected $generatedTestFiles = FALSE;
+
+  /**
    * The number of redirects followed during the handling of a request.
    */
   protected $redirect_count;
@@ -868,14 +896,35 @@ class DrupalWebTestCase extends DrupalTe
    *   List of files that match filter.
    */
   protected function drupalGetTestFiles($type, $size = NULL) {
-    $files = array();
+    if (empty($this->generatedTestFiles)) {
+      // Generate binary test files.
+      $lines = array(64, 1024);
+      $count = 0;
+      foreach ($lines as $line) {
+        simpletest_generate_file('binary-' . $count++, 64, $line, 'binary');
+      }
 
+      // Generate text test files.
+      $lines = array(16, 256, 1024, 2048, 20480);
+      $count = 0;
+      foreach ($lines as $line) {
+        simpletest_generate_file('text-' . $count++, 64, $line);
+      }
+
+      // Copy other test files from simpletest.
+      $original = drupal_get_path('module', 'simpletest') . '/files';
+      $files = file_scan_directory($original, '(html|image|javascript|php|sql)-.*');
+      foreach ($files as $file) {
+        file_copy($file->filename, variable_get('file_directory_path', conf_path() . '/files'));
+      }
+
+      $this->generatedTestFiles = TRUE;
+    }
+
+    $files = array();
     // Make sure type is valid.
     if (in_array($type, array('binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'))) {
-      // Use original file directory instead of one created during setUp().
-      $path = $this->originalFileDirectory . '/simpletest';
-//      $files = file_scan_directory($path, '/' . $type . '\-.*/');
-      $files = file_scan_directory($path, '' . $type . '\-.*');
+      $files = file_scan_directory(variable_get('file_directory_path', conf_path() . '/files'), $type . '\-.*');
 
       // If size is set then remove any files that are not of that size.
       if ($size !== NULL) {
@@ -1086,16 +1135,22 @@ class DrupalWebTestCase extends DrupalTe
    * is created with the same name as the database prefix.
    *
    * @param ...
-   *   List of modules to enable for the duration of the test.
+   *   List of modules to enable for the duration of the test. This can be
+   *   either a single array or a variable number of string arguments.
    */
   protected function setUp() {
-    global $db_prefix, $user, $language;
+    global $user, $language, $conf;
+
+    // Generate a temporary prefixed database to ensure that tests have a clean starting point.
+    $this->databasePrefix = 'simpletest' . mt_rand(1000, 1000000);
+    $db_prefix_new = $GLOBALS['db_prefix'] . $this->databasePrefix;
+    db_query("UPDATE {simpletest_test_id} SET last_prefix = '%s' WHERE test_id = %d", $db_prefix_new, $this->testId);
 
     // Store necessary current values before switching to prefixed database.
+    $this->originalPrefix = $GLOBALS['db_prefix'];
     $this->originalLanguage = $language;
-//    $this->originalLanguageDefault = variable_get('language_default');
-    $this->originalPrefix = $db_prefix;
-    $this->originalFileDirectory = file_directory_path();
+    $this->originalLanguageDefault = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''));
+    $this->originalFileDirectory = variable_get('file_directory_path', conf_path() . '/files');
     $this->originalProfile = variable_get('install_profile', 'default');
     $clean_url_original = variable_get('clean_url', 0);
 
@@ -1105,38 +1160,42 @@ class DrupalWebTestCase extends DrupalTe
       locale(NULL, NULL, TRUE);
     }
 
-    // Generate temporary prefixed database to ensure that tests have a clean starting point.
-//    $db_prefix_new = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');
-    $db_prefix_new = $db_prefix . 'simpletest' . mt_rand(1000, 1000000);
-
     // Workaround to insure we init the theme layer before going into prefixed
     // environment. (Drupal 6)
-    $this->pass(t('Starting run with db_prefix %prefix', array('%prefix' => $db_prefix_new)), 'System');
+    $this->pass(t('Starting run with db_prefix %prefix', array('%prefix' => $this->databasePrefix)), 'System');
 
-//    db_update('simpletest_test_id')
-//      ->fields(array('last_prefix' => $db_prefix_new))
-//      ->condition('test_id', $this->testId)
-//      ->execute();
-    db_query("UPDATE {simpletest_test_id}
-              SET last_prefix = '%s'
-              WHERE test_id = %d", $db_prefix_new, $this->testId);
-    $db_prefix = $db_prefix_new;
+    // Clone the current connection and replace the current prefix.
+    $GLOBALS['db_prefix'] = is_array($GLOBALS['db_prefix']) ? $GLOBALS['db_prefix']['default'] : $GLOBALS['db_prefix'] . $this->databasePrefix;
 
     // Create test directory ahead of installation so fatal errors and debug
     // information can be logged during installation process.
-    $directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10);
-//    file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
-    file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+    // Use temporary files directory with the same prefix as the database.
+    $public_files_directory  = $this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10);
+    $temp_files_directory    = $public_files_directory . '/tmp';
+
+    // Create the directories
+    file_check_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+    file_check_directory($temp_files_directory, FILE_CREATE_DIRECTORY);
+    $this->generatedTestFiles = FALSE;
 
     // Log fatal errors.
     ini_set('log_errors', 1);
-    ini_set('error_log', $directory . '/error.log');
+    ini_set('error_log', $public_files_directory . '/error.log');
+
+    // Reset all statics and variables to perform tests in a clean environment.
+    $conf = array();
+
+    // Set the test information for use in other parts of Drupal.
+    $test_info = &$GLOBALS['drupal_test_info'];
+    $test_info['test_run_id'] = $this->databasePrefix;
+    $test_info['in_child_site'] = FALSE;
 
-//    include_once DRUPAL_ROOT . '/includes/install.inc';
     include_once './includes/install.inc';
     drupal_install_system();
 
-//    $this->preloadRegistry();
+    // Set path variables.
+    variable_set('file_directory_path', $public_files_directory);
+    variable_set('file_directory_temp', $temp_files_directory);
 
     // Include the testing profile.
     variable_set('install_profile', $this->profile);
@@ -1157,12 +1216,6 @@ class DrupalWebTestCase extends DrupalTe
       drupal_install_modules($modules);
     }
 
-    // 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 the profile tasks.
     $task = 'profile';
     $function = $this->profile . '_profile_tasks';
@@ -1170,18 +1223,15 @@ class DrupalWebTestCase extends DrupalTe
       $function($task, '');
     }
 
-    // Rebuild caches.
-//    node_types_rebuild();
-    actions_synchronize();
-    _drupal_flush_css_js();
-    $this->refreshVariables();
-    $this->checkPermissions(array(), TRUE);
-    user_access(NULL, NULL, TRUE); // Drupal 6.
+    // Reset/rebuild all data structures after enabling the modules.
+    $this->resetAll();
+
+    // Run cron once in that environment, as install.php does at the end of
+    // the installation process.
+    drupal_cron_run();
 
     // Log in with a clean $user.
     $this->originalUser = $user;
-//    drupal_save_session(FALSE);
-//    $user = user_load(1);
     session_save_session(FALSE);
     $user = user_load(array('uid' => 1));
 
@@ -1189,43 +1239,37 @@ class DrupalWebTestCase extends DrupalTe
     variable_set('install_task', 'done');
     variable_set('clean_url', $clean_url_original);
     variable_set('site_mail', 'simpletest@example.com');
-//    // Set up English language.
-//    unset($GLOBALS['conf']['language_default']);
-//    $language = language_default();
+
+    // Set up English language.
+    unset($GLOBALS['conf']['language_default']);
+    $language = language_default();
 
     // Use the test mail class instead of the default mail handler class.
-//    variable_set('mail_sending_system', array('default-system' => 'TestingMailSystem'));
     variable_set('smtp_library', drupal_get_path('module', 'simpletest') . '/simpletest.mail.inc');
 
-    // Use temporary files directory with the same prefix as the database.
-//    $public_files_directory  = $this->originalFileDirectory . '/' . $db_prefix;
-//    $private_files_directory = $public_files_directory . '/private';
-    $directory = $this->originalFileDirectory . '/' . $db_prefix;
-
-    // Set path variables
-//    variable_set('file_public_path', $public_files_directory);
-//    variable_set('file_private_path', $private_files_directory);
-    variable_set('file_directory_path', $directory);
-
-    // Create the directories
-//    $directory = file_directory_path('public');
-//    file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
-//    file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);
-    file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
-
-//    drupal_set_time_limit($this->timeLimit);
     set_time_limit($this->timeLimit);
   }
 
-//  /**
-//   * This method is called by DrupalWebTestCase::setUp, and preloads the
-//   * registry from the testing site to cut down on the time it takes to
-//   * setup a clean environment for the current test run.
-//   */
-//  protected function preloadRegistry() {
-//    db_query('INSERT INTO {registry} SELECT * FROM ' . $this->originalPrefix . 'registry');
-//    db_query('INSERT INTO {registry_file} SELECT * FROM ' . $this->originalPrefix . 'registry_file');
-//  }
+  /**
+   * Reset all data structures after having enabled new modules.
+   *
+   * This method is called by DrupalWebTestCase::setUp() after enabling
+   * the requested modules. It must be called again when additional modules
+   * are enabled later.
+   */
+  protected function resetAll() {
+    // Rebuild caches.
+    drupal_flush_all_caches();
+    actions_synchronize();
+    user_access(NULL, NULL, TRUE);
+
+    // Reload global $conf array and permissions.
+    $this->refreshVariables();
+    $this->checkPermissions(array(), TRUE);
+
+    // Reset statically cached schema for new database prefix.
+    drupal_get_schema(NULL, TRUE);
+  }
 
   /**
    * Refresh the in-memory set of variables. Useful after a page request is made
@@ -1250,14 +1294,11 @@ class DrupalWebTestCase extends DrupalTe
    * and reset the database prefix.
    */
   protected function tearDown() {
-    global $db_prefix, $user, $language;
+    global $user, $language;
 
     // In case a fatal error occured that was not in the test process read the
     // log to pick up any fatal errors.
-    $db_prefix_temp = $db_prefix;
-    $db_prefix = $this->originalPrefix;
-    simpletest_log_read($this->testId, $db_prefix, get_class($this), TRUE);
-    $db_prefix = $db_prefix_temp;
+    simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE);
 
     $emailCount = count(variable_get('drupal_test_email_collector', array()));
     if ($emailCount) {
@@ -1265,57 +1306,49 @@ class DrupalWebTestCase extends DrupalTe
       $this->pass($message, t('E-mail'));
     }
 
-    if (preg_match('/simpletest\d+/', $db_prefix)) {
-      // Delete temporary files directory.
-//      file_unmanaged_delete_recursive(file_directory_path());
-      simpletest_file_unmanaged_delete_recursive(file_directory_path());
+    // Delete temporary files directory.
+    simpletest_file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10));
 
-      // Remove all prefixed tables (all the tables in the schema).
-      $schema = drupal_get_schema(NULL, TRUE);
-      $ret = array();
-      foreach ($schema as $name => $table) {
-        db_drop_table($ret, $name);
-      }
+    // Remove all prefixed tables (all the tables in the schema).
+    $schema = drupal_get_schema(NULL, TRUE);
+    $ret = array();
+    foreach ($schema as $name => $table) {
+      db_drop_table($ret, $name);
+    }
 
-      // Return the database prefix to the original.
-      $db_prefix = $this->originalPrefix;
+    // Get back to the original connection.
+    $GLOBALS['db_prefix'] = $this->originalPrefix;
 
-      // Return the user to the original one.
-      $user = $this->originalUser;
-//      drupal_save_session(TRUE);
-      session_save_session(TRUE);
+    // Return the user to the original one.
+    $user = $this->originalUser;
+    session_save_session(TRUE);
 
-      // Bring back default language. (Drupal 6)
-      if (module_exists('locale')) {
-        drupal_init_language();
-        locale(NULL, NULL, TRUE);
-      }
+    // Bring back default language. (Drupal 6)
+    if (module_exists('locale')) {
+      drupal_init_language();
+      locale(NULL, NULL, TRUE);
+    }
 
-      // Ensure that internal logged in variable and cURL options are reset.
-      $this->loggedInUser = FALSE;
-      $this->additionalCurlOptions = array();
+    // Ensure that internal logged in variable and cURL options are reset.
+    $this->loggedInUser = FALSE;
+    $this->additionalCurlOptions = array();
+
+    // Reload module list and implementations to ensure that test module hooks
+    // aren't called after tests.
+    module_list(TRUE);
+    module_implements('', '', TRUE);
 
-      // Reload module list and implementations to ensure that test module hooks
-      // aren't called after tests.
-      module_list(TRUE);
-//      module_implements('', FALSE, TRUE);
-      module_implements('', '', TRUE);
-
-      // Reset the Field API.
-//      field_cache_clear();
-
-      // Rebuild caches.
-      $this->refreshVariables();
-
-//      // Reset language.
-//      $language = $this->originalLanguage;
-//      if ($this->originalLanguageDefault) {
-//        $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
-//      }
+    // Rebuild caches.
+    $this->refreshVariables();
 
-      // Close the CURL handler.
-      $this->curlClose();
+    // Reset language.
+    $language = $this->originalLanguage;
+    if ($this->originalLanguageDefault) {
+      $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
     }
+
+    // Close the CURL handler.
+    $this->curlClose();
   }
 
   /**
@@ -1339,6 +1372,7 @@ class DrupalWebTestCase extends DrupalTe
         CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on https.
         CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on https.
         CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'),
+        CURLOPT_USERAGENT => $this->databasePrefix,
       );
       if (isset($this->httpauth_credentials)) {
         $curl_options[CURLOPT_HTTPAUTH] = $this->httpauth_method;
@@ -1351,7 +1385,7 @@ class DrupalWebTestCase extends DrupalTe
     }
     // We set the user agent header on each request so as to use the current
     // time and a new uniqid.
-    if (preg_match('/simpletest\d+/', $GLOBALS['db_prefix'], $matches)) {
+    if (preg_match('/simpletest\d+/', $this->databasePrefix, $matches)) {
       curl_setopt($this->curlHandle, CURLOPT_USERAGENT, drupal_generate_test_ua($matches[0]));
     }
   }
@@ -3020,7 +3054,7 @@ function simpletest_verbose($message, $o
     $class = $test_class;
     $verbose = variable_get('simpletest_verbose', TRUE);
     $directory = $file_directory . '/simpletest/verbose';
-    $writable = file_check_directory($directory, FILE_CREATE_DIRECTORY);
+    $writable = file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
     if ($writable && !file_exists($directory . '/.htaccess')) {
       file_put_contents($directory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n");
     }
Index: run-tests.sh
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/run-tests.sh,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 run-tests.sh
--- run-tests.sh	1 Dec 2010 05:48:50 -0000	1.1.2.8
+++ run-tests.sh	1 Dec 2010 06:49:39 -0000
@@ -1,14 +1,8 @@
 <?php
 // $Id: run-tests.sh,v 1.1.2.8 2010/12/01 05:48:50 davereid Exp $
-// Core: Id: run-tests.sh,v 1.35 2009/08/17 19:14:41 webchick Exp
-
 /**
  * @file
- * Backport of Drupal 7 run-tests.sh with modifications, see BACKPORT.txt.
- * This file must be placed in the Drupal scripts folder in order for it to
- * work properly.
- *
- * Copyright 2008-2009 by Jimmy Berry ("boombatower", http://drupal.org/user/214218)
+ * This script runs Drupal tests from command line.
  */
 
 define('SIMPLETEST_SCRIPT_COLOR_PASS', 32); // Green.
@@ -77,15 +71,11 @@ if ($args['list']) {
 $test_list = simpletest_script_get_test_list();
 
 // Try to allocate unlimited time to run the tests.
-//drupal_set_time_limit(0);
-if (!ini_get('safe_mode')) {
-  set_time_limit(0);
-}
+@set_time_limit(0);
 
 simpletest_script_reporter_init();
 
 // Setup database for test results.
-//$test_id = db_insert('simpletest_test_id')->useDefaults(array('test_id'))->execute();
 db_query('INSERT INTO {simpletest_test_id} VALUES (default)');
 $test_id = db_last_insert_id('simpletest_test_id', 'test_id');
 
@@ -236,7 +226,7 @@ function simpletest_script_parse_args() 
     exit;
   }
   elseif ($args['concurrency'] > 1 && !function_exists('pcntl_fork')) {
-    simpletest_script_print_error("Parallel test execution requires the Process Control extension to be compiled in PHP. Please see http://php.net/manual/en/intro.pcntl.php for more information.");
+    simpletest_script_print_error("Parallel test execution requires the Process Control extension to be compiled in PHP. See http://php.net/manual/en/intro.pcntl.php for more information.");
     exit;
   }
 
@@ -265,7 +255,7 @@ function simpletest_script_init($server_
     list($php, ) = explode(' ', $_ENV['SUDO_COMMAND'], 2);
   }
   else {
-    simpletest_script_print_error('Unable to automatically determine the path to the PHP interpreter. Please supply the --php command line argument.');
+    simpletest_script_print_error('Unable to automatically determine the path to the PHP interpreter. Supply the --php command line argument.');
     simpletest_script_help();
     exit();
   }
@@ -362,7 +352,6 @@ function simpletest_script_execute_batch
  * Run a single test (assume a Drupal bootstrapped environment).
  */
 function simpletest_script_run_one_test($test_id, $test_class) {
-  // Drupal 6.
   require_once drupal_get_path('module', 'simpletest') . '/drupal_web_test_case.php';
   $classes = simpletest_test_get_all_classes();
   require_once $classes[$test_class]->file;
@@ -424,11 +413,10 @@ function simpletest_script_get_test_list
 
       // Check for valid class names.
       foreach ($all_tests as $class_name) {
-        if (class_exists($class_name, FALSE)) {
-          $refclass = new ReflectionClass($class_name);
-          if (isset($files[$refclass->getFileName()])) {
-            $test_list[] = $class_name;
-          }
+        $refclass = new ReflectionClass($class_name);
+        $file = $refclass->getFileName();
+        if (isset($files[$file])) {
+          $test_list[] = $class_name;
         }
       }
     }
Index: simpletest.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/simpletest.install,v
retrieving revision 1.4.2.3.2.26
diff -u -p -r1.4.2.3.2.26 simpletest.install
--- simpletest.install	1 Dec 2010 05:48:50 -0000	1.4.2.3.2.26
+++ simpletest.install	1 Dec 2010 06:49:39 -0000
@@ -175,8 +175,6 @@ function simpletest_install() {
   // Create the SimpleTest directory.
   $path = file_directory_path() . '/simpletest';
   file_check_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
-
-  simpletest_install_generate_files();
 }
 
 /**
@@ -236,89 +234,3 @@ function simpletest_update_6201() {
   variable_del('simpletest_password', '');
   return array();
 }
-
-function simpletest_install_generate_files() {
-  $path = file_directory_path() . '/simpletest';
-
-  // Generate binary and text test files.
-  $generated = FALSE;
-  if (simpletest_get_file_count($path, 'binary') == 0) {
-    $lines = array(64, 1024);
-    foreach ($lines as $line) {
-      simpletest_generate_file('binary', 64, $line, 'binary');
-    }
-    $generated = TRUE;
-  }
-
-  if (simpletest_get_file_count($path, 'text') == 0) {
-   $lines = array(16, 256, 1024, 2048, 20480);
-   foreach ($lines as $line) {
-     simpletest_generate_file('text', 64, $line);
-   }
-   $generated = TRUE;
-  }
-
-  // Copy other test files for consistency.
-  $original = drupal_get_path('module', 'simpletest') . '/files';
-  $files = file_scan_directory($original, '(html|image|javascript|php|sql)-.*');
-
-  // If there are more files in SimpleTest's files directory than the site's
-  // files directory, restore all the files. This situation might occur when
-  // an errant test deletes one or more files from the site's files
-  // directory. It serves a convenience to developers so that they can get
-  // the test files back easily.
-  if (count($files) > count(file_scan_directory($path, '(html|image|javascript|php|sql)-.*'))) {
-    foreach ($files as $file) {
-      copy($file->filename, $path . '/' . $file->basename);
-    }
-    $generated = TRUE;
-  }
-
-  if ($generated) {
-    drupal_set_message('Extra test files generated/copied.');
-  }
-}
-
-/**
- * Generate test file.
- */
-function simpletest_generate_file($filename, $width, $lines, $type = 'binary-text') {
-  $size = $width * $lines - $lines;
-
-  // Generate random text
-  $text = '';
-  for ($i = 0; $i < $size; $i++) {
-    switch ($type) {
-      case 'text':
-        $text .= chr(rand(32, 126));
-        break;
-      case 'binary':
-        $text .= chr(rand(0, 31));
-        break;
-      case 'binary-text':
-      default:
-        $text .= rand(0, 1);
-        break;
-    }
-  }
-  $text = wordwrap($text, $width - 1, "\n", TRUE) . "\n"; // Add \n for symetrical file.
-
-  // Create filename.
-  $path = file_directory_path() . '/simpletest/';
-  $count = simpletest_get_file_count($path, $filename);
-  file_put_contents($path . $filename . '-' . ($count + 1) . '.txt', $text);
-}
-
-/**
- * Get the number of files that have the specified filename base.
- */
-function simpletest_get_file_count($directory, $filename) {
-  $files = scandir($directory);
-  $count = 0;
-  foreach ($files as $file) {
-    if (preg_match('/' . $filename . '.*?/', $file)) {
-      $count++;
-    }
-  }
-  return $count;
-}
Index: simpletest.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/simpletest.module,v
retrieving revision 1.33.2.4.2.28
diff -u -p -r1.33.2.4.2.28 simpletest.module
--- simpletest.module	1 Dec 2010 05:48:50 -0000	1.33.2.4.2.28
+++ simpletest.module	1 Dec 2010 06:49:39 -0000
@@ -358,6 +358,35 @@ function simpletest_test_get_all() {
 }
 
 /**
+ * Generate test file.
+ */
+function simpletest_generate_file($filename, $width, $lines, $type = 'binary-text') {
+  $size = $width * $lines - $lines;
+
+  // Generate random text
+  $text = '';
+  for ($i = 0; $i < $size; $i++) {
+    switch ($type) {
+      case 'text':
+        $text .= chr(rand(32, 126));
+        break;
+      case 'binary':
+        $text .= chr(rand(0, 31));
+        break;
+      case 'binary-text':
+      default:
+        $text .= rand(0, 1);
+        break;
+    }
+  }
+  $text = wordwrap($text, $width - 1, "\n", TRUE) . "\n"; // Add \n for symetrical file.
+
+  // Create filename.
+  file_put_contents(file_directory_path() . '/' . $filename . '.txt', $text);
+  return $filename;
+}
+
+/**
  * Remove all temporary database tables and directories.
  */
 function simpletest_clean_environment() {
Index: simpletest.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/simpletest.test,v
retrieving revision 1.1.2.21
diff -u -p -r1.1.2.21 simpletest.test
--- simpletest.test	13 Nov 2010 01:03:48 -0000	1.1.2.21
+++ simpletest.test	1 Dec 2010 06:49:40 -0000
@@ -421,6 +421,28 @@ class SimpleTestMailCaptureTestCase exte
 }
 
 /**
+ * Test Folder creation
+ */
+class SimpleTestFolderTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Testing SimpleTest setUp',
+      'description' => "This test will check SimpleTest's treatment of hook_install during setUp.",
+      'group' => 'SimpleTest',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('simpletest'));
+  }
+
+  function testFolderSetup() {
+    $path = file_directory_path() . '/simpletest';
+    $this->assertTrue(file_check_directory($path, FALSE), "Directory $path created.");
+  }
+}
+
+/**
  * Test required modules for tests.
  */
 class SimpleTestMissingDependentModuleUnitTest extends DrupalUnitTestCase {
