public function testRandomStrings() { $user = new User(); $last = ''; for ($i = 0; $i < 500; $i++) { $now = $user->getRandomString(); if ($now === $last) { throw new \UnexpectedValueException("Two random strings are the same, [{$now}], [{$last}]."); } $last = $now; } }