Skip to content

Commit

Permalink
Fix failing tests.
Browse files Browse the repository at this point in the history
Remove duplicated test.
  • Loading branch information
markstory committed Dec 16, 2011
1 parent 321caf6 commit f1b566b
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
Expand Up @@ -795,10 +795,11 @@ public function testLoginRedirect() {

//Ticket #4750
//named params
$this->Controller->request = $this->Auth->request;
$this->Auth->Session->delete('Auth');
$url = '/posts/index/year:2008/month:feb';
$this->Auth->request->addParams(Router::parse($url));
$this->Auth->request->url = Router::normalize($url);
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
$this->Auth->initialize($this->Controller);
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Auth->startup($this->Controller);
Expand All @@ -809,7 +810,7 @@ public function testLoginRedirect() {
$this->Auth->Session->delete('Auth');
$url = '/posts/view/1';
$this->Auth->request->addParams(Router::parse($url));
$this->Auth->request->url = Router::normalize($url);
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
$this->Auth->initialize($this->Controller);
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Auth->startup($this->Controller);
Expand All @@ -819,48 +820,30 @@ public function testLoginRedirect() {
// QueryString parameters
$_back = $_GET;
$_GET = array(
'url' => '/posts/index/29',
'print' => 'true',
'refer' => 'menu'
);
$this->Auth->Session->delete('Auth');
$url = '/posts/index/29';
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
$this->Auth->request->addParams(Router::parse($url));
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
$this->Auth->request->query = $_GET;

$this->Auth->initialize($this->Controller);
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Auth->startup($this->Controller);
$expected = Router::normalize('posts/index/29?print=true&refer=menu');
$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));

$_GET = array(
'url' => '/posts/index/29',
'print' => 'true',
'refer' => 'menu'
);
$this->Auth->Session->delete('Auth');
$url = '/posts/index/29';
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
$this->Auth->request->addParams(Router::parse($url));

$this->Auth->initialize($this->Controller);
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Auth->startup($this->Controller);
$expected = Router::normalize('posts/index/29?print=true&refer=menu');
$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));
$_GET = $_back;

//external authed action
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
$_GET = array(
'url' => '/posts/edit/1'
);
$this->Auth->Session->delete('Auth');
$url = '/posts/edit/1';
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
$this->Auth->request->addParams(Router::parse($url));
$this->Auth->request->url = Router::normalize($url);
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
$this->Auth->initialize($this->Controller);
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Auth->startup($this->Controller);
Expand Down

0 comments on commit f1b566b

Please sign in to comment.