[pLog-svn] r3938 - in plog/trunk/class/test/tests/summary: . data

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Sep 5 16:17:10 GMT 2006


Author: oscar
Date: 2006-09-05 16:17:10 +0000 (Tue, 05 Sep 2006)
New Revision: 3938

Added:
   plog/trunk/class/test/tests/summary/data/
   plog/trunk/class/test/tests/summary/data/summarytools_test.class.php
Log:
test case for mantis issue 1035 (http://bugs.lifetype.net/view.php?id=1035) -- "users can reactivate themselves by clicking the confirmation link that was sent via email"


Added: plog/trunk/class/test/tests/summary/data/summarytools_test.class.php
===================================================================
--- plog/trunk/class/test/tests/summary/data/summarytools_test.class.php	2006-09-05 15:11:17 UTC (rev 3937)
+++ plog/trunk/class/test/tests/summary/data/summarytools_test.class.php	2006-09-05 16:17:10 UTC (rev 3938)
@@ -0,0 +1,55 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+	include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );		
+	include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );	
+	include_once( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );	
+	include_once( PLOG_CLASS_PATH."class/summary/data/summarytools.class.php" );
+
+	/**
+	 * \ingroup Test
+	 *
+	 * Test case for the SummaryTools class
+	 */
+	class SummaryTools_Test extends LifeTypeTestCase
+	{
+		function setUp()
+		{
+			// build a dummy user									
+			$this->u = new UserInfo( "test", // username
+			                         "test", // password 
+			                         "test at test.com", // email
+			                         "", // about myself 
+			                         "full name" // full name
+			                       );
+			$users = new Users();
+			$users->addUser( $this->u );
+		}
+		
+		function tearDown()
+		{
+			$users = new Users();
+			$users->deleteUser( $this->u->getId());
+		}
+		
+		/**
+		 * Mantis case 1035: http://bugs.lifetype.net/view.php?id=1035
+		 * Users can reactive themselves by clicking the confirmation link that was sent to them
+		 * via email.
+		 * This test case sets our user as disabled and makes sure that SummaryTools::VerifyRequest()
+		 * returns false
+		 */
+		function testVerifyRequestIgnoreNonActiveUsers()
+		{
+			// update the user
+			$this->u->setStatus( USER_STATUS_DISABLED );
+			$users = new Users();
+			$users->updateUser( $this->u );
+			
+			// make sure it isn't returned
+			$userNameHash = md5($this->u->getUserName());
+			$requestHash  = SummaryTools::calculatePasswordResetHash( $this->u );
+			$this->assertFalse( SummaryTools::VerifyRequest( $userNameHash, $requestHash ));
+		}		
+	}
+?>
\ No newline at end of file



More information about the pLog-svn mailing list