[pLog-svn] r4039 - plog/branches/lifetype-1.1.1/class/test/helpers
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Sun Sep 24 21:02:07 GMT 2006
Author: oscar
Date: 2006-09-24 21:02:07 +0000 (Sun, 24 Sep 2006)
New Revision: 4039
Modified:
plog/branches/lifetype-1.1.1/class/test/helpers/testtools.class.php
Log:
added some code for generatingn random words, and modified the method to create dummy users to use this new method
Modified: plog/branches/lifetype-1.1.1/class/test/helpers/testtools.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/test/helpers/testtools.class.php 2006-09-24 15:17:20 UTC (rev 4038)
+++ plog/branches/lifetype-1.1.1/class/test/helpers/testtools.class.php 2006-09-24 21:02:07 UTC (rev 4039)
@@ -46,7 +46,7 @@
function createUser()
{
$user = new UserInfo(
- md5(time()),
+ TestTools::getRandomWord( 15 ),
"password",
"test at user.com",
"About test user",
@@ -146,5 +146,32 @@
}
}
}
+
+ /**
+ * Generate random words
+ */
+ function getRandomWord($lenght, $uppercase = false, $html = true)
+ {
+ $newcode_length = 1;
+ $newcode = "";
+ while($newcode_length < $lenght) {
+ $a=97;
+ $b=122;
+ if ($newcode_length == 1) {
+ if (rand(1,4) == 1 || $uppercase) {
+ $a=65;
+ $b=90;
+ }
+ }
+ $code_part=chr(rand($a,$b));
+ $newcode_length++;
+ $newcode = $newcode.$code_part;
+ }
+ if ($html && rand(1, 50) == 1) {
+ return "<a href=\"http://www.lifetype.net\">$newcode</a>";
+ }
+ return $newcode;
+ }
+
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list