UserListTest.php 850 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Userlist test class
  4. *
  5. * @author Christopher Han <xiphux@gmail.com>
  6. * @copyright Copyright (c) 2012 Christopher Han
  7. * @package GitPHP
  8. * @subpackage Test\Auth
  9. */
  10. class GitPHP_UserListTest extends PHPUnit_Framework_TestCase
  11. {
  12. public function testUserList()
  13. {
  14. $userlist = new GitPHP_UserList();
  15. $this->assertEquals(0, $userlist->GetCount());
  16. $user = new GitPHP_User('username', 'password');
  17. $userlist->AddUser($user);
  18. $this->assertEquals(1, $userlist->GetCount());
  19. $user2 = $userlist->GetUser('username');
  20. $this->assertInstanceOf('GitPHP_User', $user2);
  21. $this->assertEquals('username', $user2->GetUsername());
  22. $this->assertEquals('password', $user2->GetPassword());
  23. $userlist->RemoveUser('username');
  24. $this->assertNull($userlist->GetUser('username'));
  25. $this->assertEquals(0, $userlist->GetCount());
  26. }
  27. }