Skip to content

Commit

Permalink
Adding test for Auth login redirect to url with query string paramete…
Browse files Browse the repository at this point in the history
…rs. Disproves #6211.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8118 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
jperras committed Mar 19, 2009
1 parent 5c53fcf commit 641a483
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cake/tests/cases/libs/controller/components/auth.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,18 @@ function testLoginRedirect() {
$expected = Router::normalize('posts/view/1');
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));

// QueryString parameters
$this->Controller->Session->del('Auth');
$url = '/posts/index/29?print=true&refer=menu';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Controller->Auth->userModel = 'AuthUser';
$this->Controller->Auth->startup($this->Controller);
$expected = Router::normalize('posts/index/29?print=true&refer=menu');
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));

//external authed action
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
$this->Controller->Session->del('Auth');
Expand Down Expand Up @@ -1184,4 +1196,4 @@ function testShutDown() {
$this->assertFalse($this->Controller->Session->read('Auth.redirect'));
}
}
?>
?>

0 comments on commit 641a483

Please sign in to comment.