From 748b0b2c379a571e17a29f3da19a13b28935ebc7 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 14 Mar 2025 15:25:59 -0400 Subject: [PATCH] Add Helper class with random username generator method --- tests/Helper.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/Helper.php diff --git a/tests/Helper.php b/tests/Helper.php new file mode 100644 index 0000000..fbc665a --- /dev/null +++ b/tests/Helper.php @@ -0,0 +1,26 @@ +@'. + */ + public static function generateRandomPeer(string $domain, int $length=16, string $prefix='userTest'): string + { + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + + for ($i = 0; $i < $length; $i++) + { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + + return sprintf('%s%s@%s', $prefix, $randomString, $domain); + } + } \ No newline at end of file