Skip to content
This repository
Browse code

Test case to prove base urls are stripped.

Refs #3938, #3916.
  • Loading branch information...
commit 933013f808c64e163d3aa4309fcba361cab9b41a 1 parent 6b41eaa
Frank de Graaf authored July 26, 2013
28  lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -815,6 +815,34 @@ public function testLoginRedirect() {
815 815
 		$expected = Router::normalize('posts/index/29?print=true&refer=menu');
816 816
 		$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));
817 817
 
  818
+		// Different base urls.
  819
+		$appConfig = Configure::read('App');
  820
+
  821
+		$_GET = array();
  822
+
  823
+		Configure::write('App', array(
  824
+			'dir' => APP_DIR,
  825
+			'webroot' => WEBROOT_DIR,
  826
+			'base' => false,
  827
+			'baseUrl' => '/cake/index.php'
  828
+		));
  829
+
  830
+		$this->Auth->Session->delete('Auth');
  831
+
  832
+		$url = '/posts/add';
  833
+		$this->Auth->request = $this->Controller->request = new CakeRequest($url);
  834
+		$this->Auth->request->addParams(Router::parse($url));
  835
+		$this->Auth->request->url = Router::normalize($url);
  836
+
  837
+		$this->Auth->initialize($this->Controller);
  838
+		$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
  839
+		$this->Auth->startup($this->Controller);
  840
+		$expected = Router::normalize('/posts/add');
  841
+		$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));
  842
+
  843
+		$this->Auth->Session->delete('Auth');
  844
+		Configure::write('App', $appConfig);
  845
+
818 846
 		$_GET = $_back;
819 847
 
820 848
 		// External Authed Action

0 notes on commit 933013f

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