diff options
author | David Rothstein <drothstein@gmail.com> | 2012-07-29 22:52:53 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2012-07-29 22:52:53 -0400 |
commit | 1c2301b463881d7e8fe61677f6be642fed850d65 (patch) | |
tree | 3b8cabf78545ba01bd8a99e3a26846a69bdb0a6b /modules | |
parent | 8bd1079972d6936b571c9aa3fa26f1bb960defe7 (diff) | |
download | brdo-1c2301b463881d7e8fe61677f6be642fed850d65.tar.gz brdo-1c2301b463881d7e8fe61677f6be642fed850d65.tar.bz2 |
Issue #1672764 by iflista, xjm, tim.plunkett: Improve documentation of randomString() and randomName().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index abb0b41f9..d83dbeb6f 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -566,14 +566,21 @@ abstract class DrupalTestCase { /** * Generates a random string of ASCII characters of codes 32 to 126. * - * The generated string includes alpha-numeric characters and common misc - * characters. Use this method when testing general input where the content - * is not restricted. + * The generated string includes alpha-numeric characters and common + * miscellaneous characters. Use this method when testing general input + * where the content is not restricted. + * + * Do not use this method when special characters are not possible (e.g., in + * machine or file names that have already been validated); instead, + * use DrupalWebTestCase::randomName(). * * @param $length * Length of random string to generate. + * * @return * Randomly generated string. + * + * @see DrupalWebTestCase::randomName() */ public static function randomString($length = 8) { $str = ''; @@ -592,10 +599,16 @@ abstract class DrupalTestCase { * require machine readable values (i.e. without spaces and non-standard * characters) this method is best. * + * Do not use this method when testing unvalidated user input. Instead, use + * DrupalWebTestCase::randomString(). + * * @param $length * Length of random string to generate. + * * @return * Randomly generated string. + * + * @see DrupalWebTestCase::randomString() */ public static function randomName($length = 8) { $values = array_merge(range(65, 90), range(97, 122), range(48, 57)); |