[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/test/tests/summary/data/ -> summarytools_test.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );        
   5      lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );    
   6      lt_include( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );    
   7      lt_include( PLOG_CLASS_PATH."class/summary/data/summarytools.class.php" );
   8  
   9      /**
  10       * \ingroup Test
  11       *
  12       * Test case for the SummaryTools class
  13       */
  14      class SummaryTools_Test extends LifeTypeTestCase
  15      {
  16  		function setUp()
  17          {
  18              // build a dummy user                                    
  19              $this->u = new UserInfo( "test", // username
  20                                       "test", // password 
  21                                       "test@test.com", // email
  22                                       "", // about myself 
  23                                       "full name" // full name
  24                                     );
  25              $users = new Users();
  26              $users->addUser( $this->u );
  27          }
  28          
  29  		function tearDown()
  30          {
  31              $users = new Users();
  32              $users->deleteUser( $this->u->getId());
  33          }
  34          
  35          /**
  36           * Mantis case 1035: http://bugs.lifetype.net/view.php?id=1035
  37           * Users can reactive themselves by clicking the confirmation link that was sent to them
  38           * via email.
  39           * This test case sets our user as disabled and makes sure that SummaryTools::VerifyRequest()
  40           * returns false
  41           */
  42  		function testVerifyRequestIgnoreNonActiveUsers()
  43          {
  44              // update the user
  45              $this->u->setStatus( USER_STATUS_DISABLED );
  46              $users = new Users();
  47              $users->updateUser( $this->u );
  48              
  49              // make sure it isn't returned
  50              $userNameHash = md5($this->u->getUserName());
  51              $requestHash  = SummaryTools::calculatePasswordResetHash( $this->u );
  52              $this->assertFalse( SummaryTools::VerifyRequest( $userNameHash, $requestHash ));
  53          }        
  54          
  55          /**
  56           * Make sure that active users are included
  57           */
  58  		function testVerifyRequestActiveUsers()
  59          {
  60              // update the user
  61              $this->u->setStatus( USER_STATUS_ACTIVE );
  62              $users = new Users();
  63              $users->updateUser( $this->u );
  64              
  65              // make sure it isn't returned
  66              $userNameHash = md5($this->u->getUserName());
  67              $requestHash  = SummaryTools::calculatePasswordResetHash( $this->u );
  68              $this->assertTrue( SummaryTools::VerifyRequest( $userNameHash, $requestHash ));
  69          }        
  70      }
  71  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics