Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
0844f7c5
Commit
0844f7c5
authored
12 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#1672764
by xjm: improve documetation of randomString() and randomName().
parent
df07e0d2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+16
-3
16 additions, 3 deletions
core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
with
16 additions
and
3 deletions
core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+
16
−
3
View file @
0844f7c5
...
...
@@ -763,14 +763,21 @@ protected function exceptionHandler($exception) {
/**
* 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 allowed (e.g., in
* machine or file names); instead, use
* Drupal\simpletest\TestBase::randomName().
*
* @param $length
* Length of random string to generate.
*
* @return
* Randomly generated string.
*
* @see Drupal\simpletest\TestBase::randomName()
*/
public
static
function
randomString
(
$length
=
8
)
{
$str
=
''
;
...
...
@@ -789,10 +796,16 @@ public static function randomString($length = 8) {
* 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\simpletest\TestBase::randomString().
*
* @param $length
* Length of random string to generate.
*
* @return
* Randomly generated string.
*
* @see Drupal\simpletest\TestBase::randomString()
*/
public
static
function
randomName
(
$length
=
8
)
{
$values
=
array_merge
(
range
(
65
,
90
),
range
(
97
,
122
),
range
(
48
,
57
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment