TestUtils.class.php 554 B

1234567891011121314151617181920212223242526
  1. <?php
  2. abstract class TestUtils
  3. {
  4. public static function getRandomInteger()
  5. {
  6. return mt_rand(0, PHP_INT_MAX);
  7. }
  8. public static function getRandomString($length)
  9. {
  10. $characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_-+=[]\\{}|;':\",./<>?~`";
  11. $output = "";
  12. for($length; $length > 0; $length--)
  13. {
  14. $output .= substr(str_shuffle($characters), 0, 1);
  15. }
  16. return $output;
  17. }
  18. public static function getRandomArray()
  19. {
  20. return array(TestUtils::getRandomString(5) => TestUtils::getRandomString(5));
  21. }
  22. }