private static function PageExampleTestCase::randomNumber in Examples for Developers 6
Same name and namespace in other branches
- 7 page_example/page_example.test \PageExampleTestCase::randomNumber()
 
Generates a random string of ASCII numeric characters (values 48 to 57).
Parameters
$length: Length of random string to generate .
Return value
Randomly generated string.
1 call to PageExampleTestCase::randomNumber()
- PageExampleTestCase::testPageExampleBasic in page_example/
page_example.test  - Login user, create an example node, and test blog functionality through the admin and user interfaces.
 
File
- page_example/
page_example.test, line 37  - Test case for Testing the page example module.
 
Class
- PageExampleTestCase
 - @file Test case for Testing the page example module.
 
Code
private static function randomNumber($length = 8) {
  $str = '';
  for ($i = 0; $i < $length; $i++) {
    $str .= chr(mt_rand(48, 57));
  }
  return $str;
}