Skip to content
Permalink
Browse files

adding tests for Auth::identify()

  • Loading branch information...
ceeram authored and markstory committed May 4, 2011
1 parent d9c7f4d commit 527ff5feaf1fd46c2702bc95688d50fea5352854
Showing with 43 additions and 0 deletions.
  1. +43 −0 cake/tests/cases/libs/controller/components/auth.test.php
@@ -552,6 +552,49 @@ function testIsErrorOrTests() {
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
}
/**
* testIdentify method
*
* @access public
* @return void
*/
function testIdentify() {
$this->AuthUser =& new AuthUser();
$user['id'] = 1;
$user['username'] = 'mariano';
$user['password'] = Security::hash(Configure::read('Security.salt') . 'cake');
$this->AuthUser->save($user, false);
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->userModel = 'AuthUser';
$this->Controller->Auth->startup($this->Controller);
$this->assertTrue($this->Controller->Auth->identify($user));
}
/**
* testIdentifyWithConditions method
*
* @access public
* @return void
*/
function testIdentifyWithConditions() {
$this->AuthUser =& new AuthUser();
$user['id'] = 1;
$user['username'] = 'mariano';
$user['password'] = Security::hash(Configure::read('Security.salt') . 'cake');
$this->AuthUser->save($user, false);
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->startup($this->Controller);
$this->Controller->Auth->userModel = 'AuthUser';
$this->assertFalse($this->Controller->Auth->identify($user, array('AuthUser.id >' => 2)));
$this->Controller->Auth->userScope = array('id >' => 2);
$this->assertFalse($this->Controller->Auth->identify($user));
$this->assertTrue($this->Controller->Auth->identify($user, false));
}
/**
* testLogin method
*

0 comments on commit 527ff5f

Please sign in to comment.
You can’t perform that action at this time.