[ 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/dao/ -> userinfo_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/test/helpers/testtools.class.php" );    
   5      lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );    
   7  
   8      class UserInfo_Test extends LifeTypeTestCase
   9      {
  10          /**
  11           * Test case for Mantis issue 1139 (http://bugs.lifetype.net/view.php?id=1139):
  12           * "confirmation code is invalid"
  13           *
  14           * This test case will make sure that empty values of UserInfo::_siteAdmin() will always be loaded
  15           * and mapped to '0' when saving to the database. It should also check that when 'false' is used
  16           * in addition to '0' for this attribute, the class behaves in exactly the same way
  17           */
  18  		function testConfirmationCodeIsInvalid()
  19          {
  20              // user1, let's not set the isSiteAdmin flag and check that we return a zero and a false
  21              $user1 = new UserInfo( md5(rand()), "user1pwd", "user1@test.com", "", "User One" );
  22              $this->assertEquals( 0, $user1->isSiteAdmin(), "UserInfo::isSiteAdmin() did not return zero!" );
  23              $this->assertFalse( $user1->isSiteAdmin(), "UserInfo::isSiteAdmin() did not return false!" );
  24              
  25              // save this user to the database and make sure that the flag was saved as expected
  26              $users = new Users();
  27              $users->addUser( $user1 );
  28              // load the user
  29              $newUser1 = $users->getUserInfoFromId( $user1->getId());
  30              $this->assertEquals( 0, $newUser1->isSiteAdmin(), "UserInfo::isSiteAdmin() did not return zero after saving the user!" );
  31              $this->assertFalse( $newUser1->isSiteAdmin(), "UserInfo::isSiteAdmin() did not return false after saving the user!" );        
  32          
  33              // delete the test data
  34              TestTools::deleteDaoTestData( Array( $user1 ));
  35          }
  36      }
  37  ?>


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