Permalink
Browse files

Test case to prove base urls are stripped.

Refs #3938, #3916.
  • Loading branch information...
1 parent 6b41eaa commit 933013f808c64e163d3aa4309fcba361cab9b41a @Phally Phally committed Jul 26, 2013
Showing with 28 additions and 0 deletions.
  1. +28 −0 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -815,6 +815,34 @@ public function testLoginRedirect() {
$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

0 comments on commit 933013f

Please sign in to comment.