Skip to content
Browse files

Fix failing tests.

Remove duplicated test.
  • Loading branch information...
1 parent 321caf6 commit f1b566b88e325710a5668baf86bacfd3058ffb73 @markstory markstory committed
Showing with 6 additions and 23 deletions.
  1. +6 −23 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
View
29 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -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);
@@ -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);
@@ -819,14 +820,14 @@ 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');
@@ -834,33 +835,15 @@ public function testLoginRedirect() {
$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);

0 comments on commit f1b566b

Please sign in to comment.
Something went wrong with that request. Please try again.