Skip to content

Commit

Permalink
Fixing use of deprecated methods in Auth test.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 20, 2009
1 parent 37b5754 commit a839c29
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions cake/tests/cases/libs/controller/components/auth.test.php
Expand Up @@ -498,8 +498,8 @@ function startTest() {

ClassRegistry::addObject('view', new View($this->Controller));

$this->Controller->Session->del('Auth');
$this->Controller->Session->del('Message.auth');
$this->Controller->Session->delete('Auth');
$this->Controller->Session->delete('Message.auth');

Router::reload();

Expand All @@ -517,8 +517,8 @@ function endTest() {
$_ENV = $this->_env;
Configure::write('Acl', $this->_acl);
Configure::write('Security.salt', $this->_securitySalt);
$this->Controller->Session->del('Auth');
$this->Controller->Session->del('Message.auth');
$this->Controller->Session->delete('Auth');
$this->Controller->Session->delete('Message.auth');
ClassRegistry::flush();
unset($this->Controller, $this->AuthUser);
}
Expand Down Expand Up @@ -586,7 +586,7 @@ function testLogin() {
'id' => 1, 'username' => 'mariano', 'created' => '2007-03-17 01:16:23', 'updated' => date('Y-m-d H:i:s')
));
$this->assertEqual($user, $expected);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');

$this->Controller->data['AuthUser']['username'] = 'blah';
$this->Controller->data['AuthUser']['password'] = '';
Expand All @@ -595,7 +595,7 @@ function testLogin() {

$user = $this->Controller->Auth->user();
$this->assertFalse($user);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');

$this->Controller->data['AuthUser']['username'] = 'now() or 1=1 --';
$this->Controller->data['AuthUser']['password'] = '';
Expand All @@ -604,7 +604,7 @@ function testLogin() {

$user = $this->Controller->Auth->user();
$this->assertFalse($user);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');

$this->Controller->data['AuthUser']['username'] = 'now() or 1=1 # something';
$this->Controller->data['AuthUser']['password'] = '';
Expand All @@ -613,7 +613,7 @@ function testLogin() {

$user = $this->Controller->Auth->user();
$this->assertFalse($user);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');

$this->Controller->Auth->userModel = 'UuidUser';
$this->Controller->Auth->login('47c36f9c-bc00-4d17-9626-4e183ca6822b');
Expand All @@ -623,7 +623,7 @@ function testLogin() {
'id' => '47c36f9c-bc00-4d17-9626-4e183ca6822b', 'title' => 'Unique record 1', 'count' => 2, 'created' => '2008-03-13 01:16:23', 'updated' => '2008-03-13 01:18:31'
));
$this->assertEqual($user, $expected);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
}

/**
Expand All @@ -642,7 +642,7 @@ function testAuthorizeFalse() {
$result = $this->Controller->Auth->startup($this->Controller);
$this->assertTrue($result);

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$result = $this->Controller->Auth->startup($this->Controller);
$this->assertFalse($result);
$this->assertTrue($this->Controller->Session->check('Message.auth'));
Expand Down Expand Up @@ -673,7 +673,7 @@ function testAuthorizeController() {
$this->assertTrue($this->Controller->Session->check('Message.auth'));
$this->assertFalse($result);

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
}

/**
Expand All @@ -695,7 +695,7 @@ function testAuthorizeModel() {
$result = $this->Controller->Auth->startup($this->Controller);
$this->assertTrue($result);

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$this->Controller->Auth->startup($this->Controller);
$this->assertTrue($this->Controller->Session->check('Message.auth'));
$result = $this->Controller->Auth->isAuthorized();
Expand Down Expand Up @@ -759,7 +759,7 @@ function testAuthorizeCrud() {
$this->Controller->Auth->startup($this->Controller);
$this->assertTrue($this->Controller->Auth->isAuthorized());

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$this->Controller->Auth->startup($this->Controller);
$this->assertTrue($this->Controller->Session->check('Message.auth'));
}
Expand Down Expand Up @@ -932,7 +932,7 @@ function testLoginRedirect() {
$expected = Router::normalize($this->Controller->Auth->loginRedirect);
$this->assertEqual($expected, $this->Controller->Auth->redirect());

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');

$this->Controller->params['url']['url'] = 'admin/';
$this->Controller->Auth->initialize($this->Controller);
Expand All @@ -943,7 +943,7 @@ function testLoginRedirect() {
$this->assertTrue($this->Controller->Session->check('Message.auth'));
$this->assertEqual($expected, $this->Controller->Auth->redirect());

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');

//empty referer no session
$_SERVER['HTTP_REFERER'] = false;
Expand Down Expand Up @@ -971,7 +971,7 @@ function testLoginRedirect() {
$this->assertEqual($expected, $this->Controller->testUrl);


$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$_SERVER['HTTP_REFERER'] = Router::url('/admin/', true);

$this->Controller->Session->write('Auth', array(
Expand All @@ -988,7 +988,7 @@ function testLoginRedirect() {

//Ticket #4750
//named params
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$url = '/posts/index/year:2008/month:feb';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
Expand All @@ -1000,7 +1000,7 @@ function testLoginRedirect() {
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));

//passed args
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$url = '/posts/view/1';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
Expand All @@ -1018,7 +1018,7 @@ function testLoginRedirect() {
'print' => 'true',
'refer' => 'menu'
);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$url = '/posts/index/29?print=true&refer=menu';
$this->Controller->params = Dispatcher::parseParams($url);
$this->Controller->Auth->initialize($this->Controller);
Expand All @@ -1034,7 +1034,7 @@ function testLoginRedirect() {
'refer' => 'menu',
'ext' => 'html'
);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$url = '/posts/index/29?print=true&refer=menu';
$this->Controller->params = Dispatcher::parseParams($url);
$this->Controller->Auth->initialize($this->Controller);
Expand All @@ -1047,7 +1047,7 @@ function testLoginRedirect() {

//external authed action
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$url = '/posts/edit/1';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
Expand All @@ -1060,7 +1060,7 @@ function testLoginRedirect() {

//external direct login link
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$url = '/AuthTest/login';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
Expand All @@ -1072,7 +1072,7 @@ function testLoginRedirect() {
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));

$_SERVER['HTTP_REFERER'] = $backup;
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
}

/**
Expand All @@ -1082,7 +1082,7 @@ function testLoginRedirect() {
* @return void
**/
function testNoRedirectOn404() {
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->params = Router::parse('auth_test/something_totally_wrong');
$result = $this->Controller->Auth->startup($this->Controller);
Expand Down Expand Up @@ -1117,7 +1117,7 @@ function testEmptyUsernameOrPassword() {
$user = $this->Controller->Auth->user();
$this->assertTrue($this->Controller->Session->check('Message.auth'));
$this->assertEqual($user, false);
$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
}

/**
Expand All @@ -1142,7 +1142,7 @@ function testInjection() {
$this->Controller->Auth->startup($this->Controller);
$this->assertTrue(is_array($this->Controller->Auth->user()));

$this->Controller->Session->del($this->Controller->Auth->sessionKey);
$this->Controller->Session->delete($this->Controller->Auth->sessionKey);

$this->Controller->data['AuthUser']['username'] = 'nate';
$this->Controller->data['AuthUser']['password'] = 'cake1';
Expand All @@ -1154,7 +1154,7 @@ function testInjection() {
$this->Controller->Auth->startup($this->Controller);
$this->assertTrue(is_null($this->Controller->Auth->user()));

$this->Controller->Session->del($this->Controller->Auth->sessionKey);
$this->Controller->Session->delete($this->Controller->Auth->sessionKey);

$this->Controller->data['AuthUser']['username'] = '> n';
$this->Controller->data['AuthUser']['password'] = 'cake';
Expand Down Expand Up @@ -1251,7 +1251,7 @@ function testCustomRoute() {
$user = $this->Controller->Auth->user();
$this->assertTrue(!!$user);

$this->Controller->Session->del('Auth');
$this->Controller->Session->delete('Auth');
Router::reload();
Router::connect('/', array('controller' => 'people', 'action' => 'login'));
$url = '/';
Expand Down

0 comments on commit a839c29

Please sign in to comment.