diff -u b/core/lib/Drupal/Component/Utility/Random.php b/core/lib/Drupal/Component/Utility/Random.php --- b/core/lib/Drupal/Component/Utility/Random.php +++ b/core/lib/Drupal/Component/Utility/Random.php @@ -8,7 +8,7 @@ namespace Drupal\Component\Utility; /** - * Utility class for creating random data. + * Defines a utility class for creating random data. */ class Random { @@ -43,10 +43,6 @@ * 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 - * \Drupal\Component\Utility\Random::name(). - * * @param int $length * Length of random string to generate. * @@ -80,9 +76,6 @@ * 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 - * \Drupal\Component\Utility\Random::string(). - * * @param int $length * Length of random string to generate. * diff -u b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -1155,6 +1155,10 @@ /** * Generates a unique random string of ASCII characters of codes 32 to 126. * + * 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 + * \Drupal\simpletest\TestBase::randomName(). + * * @param int $length * Length of random string to generate. * @@ -1170,6 +1174,9 @@ /** * Generates a unique random string containing letters and numbers. * + * Do not use this method when testing unvalidated user input. Instead, use + * \Drupal\simpletest\TestBase::randomString(). + * * @param int $length * Length of random string to generate. * diff -u b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php --- b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php @@ -11,7 +11,7 @@ use Drupal\Tests\UnitTestCase; /** - * Tests random data generating. + * Tests random data generation. * * @see \Drupal\Component\Utility\Random */ @@ -36,7 +36,7 @@ $strings[$str] = TRUE; } - // There are less than 100 possibilities so an exception should occur to + // There are fewer than 100 possibilities so an exception should occur to // prevent infinite loops. $runtime_exception = FALSE; try { @@ -63,7 +63,7 @@ $names[$str] = TRUE; } - // There are less than 100 possibilities so an exception should occur to + // There are fewer than 100 possibilities so an exception should occur to // prevent infinite loops. $runtime_exception = FALSE; try {