mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
5689a9af03
commit
82b263a8aa
1 changed files with 20 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue