From 933013f808c64e163d3aa4309fcba361cab9b41a Mon Sep 17 00:00:00 2001 From: Phally Date: Fri, 26 Jul 2013 07:04:21 +0200 Subject: [PATCH] Test case to prove base urls are stripped. Refs #3938, #3916. --- .../Component/AuthComponentTest.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index aac0e5228..73366e017 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -815,6 +815,34 @@ class AuthComponentTest extends CakeTestCase { $expected = Router::normalize('posts/index/29?print=true&refer=menu'); $this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect')); + // Different base urls. + $appConfig = Configure::read('App'); + + $_GET = array(); + + Configure::write('App', array( + 'dir' => APP_DIR, + 'webroot' => WEBROOT_DIR, + 'base' => false, + 'baseUrl' => '/cake/index.php' + )); + + $this->Auth->Session->delete('Auth'); + + $url = '/posts/add'; + $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->initialize($this->Controller); + $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); + $this->Auth->startup($this->Controller); + $expected = Router::normalize('/posts/add'); + $this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect')); + + $this->Auth->Session->delete('Auth'); + Configure::write('App', $appConfig); + $_GET = $_back; // External Authed Action