Skip to content

Commit

Permalink
Updating test case with a bad merge to match the original one in bran…
Browse files Browse the repository at this point in the history
…ch 2.0
  • Loading branch information
lorenzo committed Mar 5, 2011
1 parent f1e2f5e commit f844283
Showing 1 changed file with 1 addition and 61 deletions.
62 changes: 1 addition & 61 deletions lib/Cake/tests/cases/libs/controller/components/auth.test.php
Expand Up @@ -44,7 +44,7 @@ class TestAuthComponent extends AuthComponent {
* @access public
* @return void
*/
function _stop() {
function _stop($status = 0) {
$this->testStop = true;
}

Expand Down Expand Up @@ -930,66 +930,6 @@ function testAdminRoute() {
Configure::write('Routing.prefixes', $prefixes);
}

/**
* testPluginModel method
*
* @access public
* @return void
*/
function testPluginModel() {
// Adding plugins
Cache::delete('object_map', '_cake_core_');
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
'Model' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'models' . DS)
), true);
App::objects('plugin', null, false);

$PluginModel = ClassRegistry::init('TestPlugin.TestPluginAuthUser');
$user['id'] = 1;
$user['username'] = 'gwoo';
$user['password'] = Security::hash(Configure::read('Security.salt') . 'cake');
$PluginModel->save($user, false);

$authUser = $PluginModel->find();

$this->Controller->request->data['TestPluginAuthUser'] = array(
'username' => $authUser['TestPluginAuthUser']['username'], 'password' => 'cake'
);

$this->Controller->request->addParams(Router::parse('auth_test/login'));
$this->Controller->request->query['url'] = 'auth_test/login';

$this->Controller->Auth->initialize($this->Controller);

$this->Controller->Auth->loginAction = 'auth_test/login';
$this->Controller->Auth->userModel = 'TestPlugin.TestPluginAuthUser';

$this->Controller->Auth->startup($this->Controller);
$user = $this->Controller->Auth->user();
$expected = array('TestPluginAuthUser' => array(
'id' => 1, 'username' => 'gwoo', 'created' => '2007-03-17 01:16:23', 'updated' => date('Y-m-d H:i:s')
));
$this->assertEqual($user, $expected);
$sessionKey = $this->Controller->Auth->sessionKey;
$this->assertEqual('Auth.TestPluginAuthUser', $sessionKey);

$this->Controller->Auth->loginAction = null;
$this->Controller->Auth->__setDefaults();
$loginAction = $this->Controller->Auth->loginAction;
$expected = array(
'controller' => 'test_plugin_auth_users',
'action' => 'login',
'plugin' => 'test_plugin'
);
$this->assertEqual($loginAction, $expected);

// Reverting changes
Cache::delete('object_map', '_cake_core_');
App::build();
App::objects('plugin', null, false);
}

/**
* testAjaxLogin method
*
Expand Down

0 comments on commit f844283

Please sign in to comment.