From 82b263a8aa6697048950d8135ccd038b71f8fb96 Mon Sep 17 00:00:00 2001 From: gwoo Date: Wed, 15 Aug 2007 19:33:46 +0000 Subject: [PATCH] updating auth test git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5530 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../libs/controller/components/auth.test.php | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 3a450d89b..05342d3f6 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -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); }