[pLog-svn] r5902 - plog/branches/lifetype-1.2/class/test/helpers

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Tue Sep 4 01:01:38 EDT 2007


Author: jondaley
Date: 2007-09-04 01:01:37 -0400 (Tue, 04 Sep 2007)
New Revision: 5902

Modified:
   plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php
Log:
usernames can't have html nor uppercase in them.  getRandomWord now returns the right number of characters, as well as not putting in uppercase unless specified

Modified: plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php	2007-09-04 05:00:41 UTC (rev 5901)
+++ plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php	2007-09-04 05:01:37 UTC (rev 5902)
@@ -46,7 +46,7 @@
 		function createUser()
 		{
 			$user = new UserInfo(
-				TestTools::getRandomWord( 15 ),
+				TestTools::getRandomWord( 15, false, false ),
 				"password",
 				"test at user.com",
 				"About test user",
@@ -68,7 +68,7 @@
 		function createAdminUser()
 		{
 			$user = new UserInfo(
-				TestTools::getRandomWord( 15 ),
+				TestTools::getRandomWord( 15, false, false ),
 				"password",
 				"test at user.com",
 				"About test user",
@@ -238,15 +238,15 @@
 		/**
 		 * Generate random words
 		 */
-		function getRandomWord($lenght, $uppercase = false, $html = true) 
+		function getRandomWord($length, $uppercase = false, $html = true) 
 		{
-		    $newcode_length = 1;
+		    $newcode_length = 0;
 		    $newcode = "";
-		    while($newcode_length < $lenght) {
+		    while($newcode_length < $length) {
 		        $a=97;
 		        $b=122;
-		        if ($newcode_length == 1) {
-		            if (rand(1,4) == 1 || $uppercase) {
+		        if ($newcode_length == 0) {
+		            if (rand(1,4) == 1 && $uppercase) {
 		                $a=65;
 		                $b=90;
 		            }



More information about the pLog-svn mailing list