1234567891011121314151617181920212223242526 |
- <?php
- abstract class TestUtils
- {
- public static function getRandomInteger()
- {
- return mt_rand(0, PHP_INT_MAX);
- }
- public static function getRandomString($length)
- {
- $characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_-+=[]\\{}|;':\",./<>?~`";
- $output = "";
- for($length; $length > 0; $length--)
- {
- $output .= substr(str_shuffle($characters), 0, 1);
- }
- return $output;
- }
- public static function getRandomArray()
- {
- return array(TestUtils::getRandomString(5) => TestUtils::getRandomString(5));
- }
- }
|