예제 #1
0
 /**
  * Test get password
  *
  */
 public function testSetPassword()
 {
     $password = 654321;
     $this->_user->password = $password;
     $this->_user->save();
     $this->assertTrue(Users_Model_User_Manager::authenticate($this->_user->login, $password));
 }
예제 #2
0
 /**
  * TODO remove hard code
  *
  */
 function testAuthenticate()
 {
     // guest user login/password (non activated)
     $result = Users_Model_User_Manager::authenticate($this->_fixture['guest']['login'], $this->_fixture['guest']['password']);
     $this->assertFalse($result);
     // blocked user login/password
     $result = Users_Model_User_Manager::authenticate($this->_fixture['blocked']['login'], $this->_fixture['blocked']['password']);
     $this->assertFalse($result);
     // removed login/password
     $result = Users_Model_User_Manager::authenticate($this->_fixture['removed']['login'], $this->_fixture['removed']['password']);
     $this->assertFalse($result);
     // wrong login/password
     $result = Users_Model_User_Manager::authenticate($this->_fixture['admin']['login'], $this->_fixture['admin']['password'] . 'd');
     $this->assertFalse($result);
     // right login/password
     $result = Users_Model_User_Manager::authenticate($this->_fixture['admin']['login'], $this->_fixture['admin']['password']);
     $this->assertTrue($result);
     // chech Zend_Auth
     $this->assertEquals(Users_Model_User::ROLE_ADMIN, Zend_Auth::getInstance()->getIdentity()->role);
 }
 /**
  * Change password
  */
 public function testRecoverPasswordAction()
 {
     $userManager = new Users_Model_User_Manager();
     $user = $userManager->forgetPassword($this->_user['email']);
     $hash = $user->hashCode;
     $this->dispatch('/recover-password/' . $hash);
     $this->assertModule('users');
     $this->assertController('login');
     $this->assertAction('recover-password');
     $this->assertQueryCount('form#userNewPasswordForm', 1);
     $this->assertNotRedirect();
 }
 /**
  * Test forget password
  *
  */
 public function testForgetPasswordAction()
 {
     Users_Model_User_Manager::logout();
     $user = $this->_userTable->createRow($this->_fixture);
     $user->save();
     $this->dispatch('/users/register/forget-password');
     $this->assertModule('users');
     $this->assertController('register');
     $this->assertAction('forget-password');
     $this->assertQuery('form#userForgetPasswordForm');
     //$this->markTestIncomplete('forget password don\'t pass this is test, hidden dependency?');
     //        $this->request
     //             ->setMethod('POST')
     //             ->setPost(array('email' => $this->_fixture['email']));
     //
     //        $this->dispatch('/users/register/forget-password');
     //        $this->assertModule('users');
     //        $this->assertController('register');
     //        $this->assertAction('forget-password');
     //        $this->assertRedirectTo("/login");
     $user->delete();
 }