updating auth test

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5530 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-08-15 19:33:46 +00:00
parent 5689a9af03
commit 82b263a8aa

View file

@ -228,18 +228,34 @@ class AuthTest extends CakeTestCase {
$_SERVER['HTTP_REFERER'] = false;
$this->Controller->data = array();
$this->Controller->params['url']['url'] = 'users/login';
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'welcome');
$this->Controller->Auth->startup($this->Controller);
$this->Controller->params['url']['url'] = 'users/login';
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->startup($this->Controller);
$expected = $this->Controller->Auth->_normalizeURL($this->Controller->Auth->loginRedirect);
$this->assertEqual($expected, $this->Controller->Auth->redirect());
$this->Controller->Session->del('Auth');
$this->Controller->params['url']['url'] = 'admin/';
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->startup($this->Controller);
$expected = $this->Controller->Auth->_normalizeURL('admin/');
$this->assertEqual($expected, $this->Controller->Auth->redirect());
$this->Controller->Session->del('Auth');
$_SERVER['HTTP_REFERER'] = '/admin/';
$this->Controller->params['url']['url'] = 'users/login';
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->startup($this->Controller);
$expected = '/admin/';
$this->assertEqual($expected, $this->Controller->Auth->redirect());
$this->Controller->Session->del('Auth');
$_SERVER['HTTP_REFERER'] = $backup;
}
function tearDown() {
unset($this->Controller, $this->AuthUser);
}