Skip to content

Commit

Permalink
Fix failing test and removing tests for settings that no longer exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 4, 2011
1 parent ba02483 commit 67c4c9a
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions cake/tests/cases/libs/controller/components/auth.test.php
Expand Up @@ -740,7 +740,7 @@ function testLoadAuthorizeResets() {
*/
function testLoadAuthenticateNoFile() {
$this->Controller->Auth->authenticate = 'Missing';
$this->Controller->Auth->identify($this->Controller->request);
$this->Controller->Auth->identify($this->Controller->request, $this->Controller->response);
}

/**
Expand Down Expand Up @@ -1176,47 +1176,20 @@ function testComponentSettings() {

$this->Controller->components = array(
'Auth' => array(
'fields' => array('username' => 'email', 'password' => 'password'),
'loginAction' => array('controller' => 'people', 'action' => 'login'),
'userModel' => 'AuthUserCustomField'
),
'Session'
);
$this->Controller->Components->init($this->Controller);
$this->Controller->Components->trigger('initialize', array(&$this->Controller));
Router::reload();

$this->AuthUserCustomField = new AuthUserCustomField();
$user = array(
'id' => 1, 'email' => 'harking@example.com',
'password' => Security::hash(Configure::read('Security.salt') . 'cake'
));
$user = $this->AuthUserCustomField->save($user, false);

Router::connect('/', array('controller' => 'people', 'action' => 'login'));
$url = '/';
$this->Controller->request->addParams(Router::parse($url));
Router::setRequestInfo($this->Controller->request);
$this->Controller->request->data['AuthUserCustomField'] = array(
'email' => 'harking@example.com', 'password' => 'cake'
);
$this->Controller->request->query['url'] = substr($url, 1);
$this->Controller->Auth->startup($this->Controller);
$this->Controller->Auth->login();

$user = $this->Controller->Auth->user();
$this->assertTrue(!!$user);

$expected = array(
'fields' => array('username' => 'email', 'password' => 'password'),
'loginAction' => array('controller' => 'people', 'action' => 'login'),
'logoutRedirect' => array('controller' => 'people', 'action' => 'login'),
'userModel' => 'AuthUserCustomField'
);
$this->assertEqual($expected['fields'], $this->Controller->Auth->fields);
$this->assertEqual($expected['loginAction'], $this->Controller->Auth->loginAction);
$this->assertEqual($expected['logoutRedirect'], $this->Controller->Auth->logoutRedirect);
$this->assertEqual($expected['userModel'], $this->Controller->Auth->userModel);
}

/**
Expand Down

0 comments on commit 67c4c9a

Please sign in to comment.