1 | <?php |
||
21 | class TestCase extends PHPUnitTestCase |
||
22 | { |
||
23 | const ARRAY_MIN_ITEMS = 2; |
||
24 | const ARRAY_MAX_ITEMS = 10; |
||
25 | |||
26 | /** |
||
27 | * Create a random string |
||
28 | * |
||
29 | * @param int $length the length of the string to create |
||
30 | * @return string |
||
31 | * @author XEWeb <> |
||
32 | */ |
||
33 | protected function randomString(int $length = 6): string |
||
34 | { |
||
35 | $str = ''; |
||
36 | $characters = array_merge(range('A','Z'), range('a','z'), range('0','9')); |
||
37 | $max = count($characters) - 1; |
||
38 | for ($i = 0; $i < $length; $i++) { |
||
39 | $rand = mt_rand(0, $max); |
||
40 | $str .= $characters[$rand]; |
||
41 | } |
||
42 | return $str; |
||
43 | } |
||
44 | } |
||
45 |