summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2012-07-29 22:52:53 -0400
committerDavid Rothstein <drothstein@gmail.com>2012-07-29 22:52:53 -0400
commit1c2301b463881d7e8fe61677f6be642fed850d65 (patch)
tree3b8cabf78545ba01bd8a99e3a26846a69bdb0a6b /modules
parent8bd1079972d6936b571c9aa3fa26f1bb960defe7 (diff)
downloadbrdo-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.php19
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));