#998898: Reduce the length of the Simpletest prefix

From: Damien Tournoud <damien@commerceguys.com>


---
 bootstrap.inc                       |    2 +-
 simpletest/drupal_web_test_case.php |    8 ++++----
 simpletest/simpletest.module        |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git includes/bootstrap.inc includes/bootstrap.inc
index a67f12f..76fb82e 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -2306,7 +2306,7 @@ function drupal_valid_test_ua() {
     return $test_prefix;
   }
 
-  if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^(simpletest\d+);(.+);(.+);(.+)$/", $_SERVER['HTTP_USER_AGENT'], $matches)) {
+  if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^(s\d+);(.+);(.+);(.+)$/", $_SERVER['HTTP_USER_AGENT'], $matches)) {
     list(, $prefix, $time, $salt, $hmac) = $matches;
     $check_string =  $prefix . ';' . $time . ';' . $salt;
     // We use the salt from settings.php to make the HMAC key, since
diff --git modules/simpletest/drupal_web_test_case.php modules/simpletest/drupal_web_test_case.php
index fa57e72..8736aa0 100644
--- modules/simpletest/drupal_web_test_case.php
+++ modules/simpletest/drupal_web_test_case.php
@@ -5,7 +5,7 @@
  * 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_%"
+ *  - 'test_run_id': the ID of the test being run, in the form 's%'
  *  - 'in_child_site': TRUE if the current request is a cURL request from
  *     the parent site.
  *
@@ -615,7 +615,7 @@ class DrupalUnitTestCase extends DrupalTestCase {
     drupal_static_reset();
 
     // Generate temporary prefixed database to ensure that tests have a clean starting point.
-    $this->databasePrefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');
+    $this->databasePrefix = Database::getConnection()->prefixTables('{s' . mt_rand(1000, 1000000) . '}');
 
     // Create test directory.
     $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10);
@@ -1184,7 +1184,7 @@ class DrupalWebTestCase extends DrupalTestCase {
     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);
+    $this->databasePrefix = 's' . mt_rand(1000, 1000000);
     db_update('simpletest_test_id')
       ->fields(array('last_prefix' => $this->databasePrefix))
       ->condition('test_id', $this->testId)
@@ -1454,7 +1454,7 @@ class DrupalWebTestCase extends DrupalTestCase {
     }
     // 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+/', $this->databasePrefix, $matches)) {
+    if (preg_match('/s\d+/', $this->databasePrefix, $matches)) {
       curl_setopt($this->curlHandle, CURLOPT_USERAGENT, drupal_generate_test_ua($matches[0]));
     }
   }
diff --git modules/simpletest/simpletest.module modules/simpletest/simpletest.module
index ea64aeb..24cf952 100644
--- modules/simpletest/simpletest.module
+++ modules/simpletest/simpletest.module
@@ -435,7 +435,7 @@ function simpletest_clean_database() {
   foreach (array_diff_key($tables, $schema) as $table) {
     // Strip the prefix and skip tables without digits following "simpletest",
     // e.g. {simpletest_test_id}.
-    if (preg_match('/simpletest\d+.*/', $table, $matches)) {
+    if (preg_match('/s\d+.*/', $table, $matches)) {
       db_drop_table($matches[0]);
       $count++;
     }
