Beispiel #1
0
 public function testBasics()
 {
     $user = new User();
     $user->setUsername("felicitus");
     $this->assertEquals($user->getUsername(), "felicitus");
     $user->setUsername("Timo A. Hummel");
     $this->assertEquals($user->getUsername(), "Timo A. Hummel");
     $user->setPassword("foobar");
     $hashedPassword = "******";
     $this->assertEquals($user->comparePassword("foobar"), true, "Error comparing passwords: PasswordTest01");
     $this->assertEquals($user->compareHashedPassword($hashedPassword), true, "Error comparing passwords: PasswordTest02");
     $user->setHashedPassword($hashedPassword);
     $this->assertEquals($user->comparePassword("foobar"), true, "Error comparing passwords: PasswordTest03");
     $this->assertEquals($user->compareHashedPassword($hashedPassword), true, "Error comparing passwords: PasswordTest04");
 }
Beispiel #2
0
 /**
  * Tests creating new users.
  */
 public function testCreateUser()
 {
     $username = "******";
     $password = "******";
     $user = new User($username, $password);
     // Make sure that the new user isn't an admin.
     $this->assertEquals(false, $user->isAdmin());
     $this->assertEquals($username, $user->getUsername());
     $this->assertEquals(true, $user->comparePassword($password));
 }