diff --git a/cake/libs/cake_request.php b/cake/libs/cake_request.php index 0ff573bd8..7a80b43a5 100644 --- a/cake/libs/cake_request.php +++ b/cake/libs/cake_request.php @@ -167,15 +167,15 @@ class CakeRequest implements ArrayAccess { } else { $query = $_GET; } + if (strpos($this->url, '?') !== false) { list(, $querystr) = explode('?', $this->url); parse_str($querystr, $queryArgs); - $query += $queryArgs; + $query += $queryArgs; } if (isset($this->params['url'])) { $query = array_merge($this->params['url'], $query); } - $query['url'] = $this->url; $this->query = $query; } diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 6aa6a9aeb..5a2eebce3 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -289,8 +289,8 @@ class AuthComponent extends Component { $url = ''; - if (isset($request->query['url'])) { - $url = $request->query['url']; + if (isset($request->url)) { + $url = $request->url; } $url = Router::normalize($url); $loginAction = Router::normalize($this->loginAction); diff --git a/cake/tests/cases/console/shells/api.test.php b/cake/tests/cases/console/shells/api.test.php index 79deea551..99e5abf33 100644 --- a/cake/tests/cases/console/shells/api.test.php +++ b/cake/tests/cases/console/shells/api.test.php @@ -66,20 +66,19 @@ class ApiShellTest extends CakeTestCase { '8. getResponse()', '9. header($status)', '10. httpCodes($code = NULL)', - '11. isAuthorized()', - '12. loadModel($modelClass = NULL, $id = NULL)', - '13. paginate($object = NULL, $scope = array (), $whitelist = array ())', - '14. postConditions($data = array (), $op = NULL, $bool = \'AND\', $exclusive = false)', - '15. redirect($url, $status = NULL, $exit = true)', - '16. referer($default = NULL, $local = false)', - '17. render($action = NULL, $layout = NULL, $file = NULL)', - '18. set($one, $two = NULL)', - '19. setAction($action)', - '20. setRequest($request)', - '21. shutdownProcess()', - '22. startupProcess()', - '23. validate()', - '24. validateErrors()' + '11. loadModel($modelClass = NULL, $id = NULL)', + '12. paginate($object = NULL, $scope = array (), $whitelist = array ())', + '13. postConditions($data = array (), $op = NULL, $bool = \'AND\', $exclusive = false)', + '14. redirect($url, $status = NULL, $exit = true)', + '15. referer($default = NULL, $local = false)', + '16. render($view = NULL, $layout = NULL)', + '17. set($one, $two = NULL)', + '18. setAction($action)', + '19. setRequest($request)', + '20. shutdownProcess()', + '21. startupProcess()', + '22. validate()', + '23. validateErrors()' ); $this->Shell->expects($this->at(2))->method('out')->with($expected); diff --git a/cake/tests/cases/libs/cake_request.test.php b/cake/tests/cases/libs/cake_request.test.php index 41cf77f21..0a1381e9d 100644 --- a/cake/tests/cases/libs/cake_request.test.php +++ b/cake/tests/cases/libs/cake_request.test.php @@ -74,12 +74,11 @@ class CakeRequestTestCase extends CakeTestCase { 'two' => 'banana' ); $request = new CakeRequest('some/path'); - $this->assertEqual($request->query, $_GET + array('url' => 'some/path')); + $this->assertEqual($request->query, $_GET); $_GET = array( 'one' => 'param', 'two' => 'banana', - 'url' => 'some/path' ); $request = new CakeRequest('some/path'); $this->assertEqual($request->query, $_GET); @@ -94,8 +93,10 @@ class CakeRequestTestCase extends CakeTestCase { function testQueryStringParsingFromInputUrl() { $_GET = array(); $request = new CakeRequest('some/path?one=something&two=else'); - $expected = array('one' => 'something', 'two' => 'else', 'url' => 'some/path?one=something&two=else'); + $expected = array('one' => 'something', 'two' => 'else'); $this->assertEqual($request->query, $expected); + $this->assertEquals('some/path?one=something&two=else', $request->url); + } /** diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 840065181..2c6701e93 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -443,7 +443,7 @@ class AuthTest extends CakeTestCase { $this->Controller->data = array(); $this->Controller->request->addParams(Router::parse('auth_test/login')); - $this->Controller->request->query['url'] = 'auth_test/login'; + $this->Controller->request->url = 'auth_test/login'; $this->Auth->Session->delete('Auth'); $this->Auth->loginRedirect = '/users/dashboard'; @@ -730,7 +730,7 @@ class AuthTest extends CakeTestCase { )); $this->Auth->request->addParams(Router::parse('users/login')); - $this->Auth->request->query['url'] = 'users/login'; + $this->Auth->request->url = 'users/login'; $this->Auth->initialize($this->Controller); $this->Auth->loginRedirect = array( @@ -771,7 +771,7 @@ class AuthTest extends CakeTestCase { 'AuthUser' => array('id'=>'1', 'username' => 'nate') )); $this->Auth->request->params['action'] = 'login'; - $this->Auth->request->query['url'] = 'auth_test/login'; + $this->Auth->request->url = 'auth_test/login'; $this->Auth->initialize($this->Controller); $this->Auth->loginAction = 'auth_test/login'; $this->Auth->loginRedirect = false; @@ -784,7 +784,7 @@ class AuthTest extends CakeTestCase { $this->Auth->Session->delete('Auth'); $url = '/posts/index/year:2008/month:feb'; $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->query['url'] = Router::normalize($url); + $this->Auth->request->url = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); @@ -795,7 +795,7 @@ class AuthTest extends CakeTestCase { $this->Auth->Session->delete('Auth'); $url = '/posts/view/1'; $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->query['url'] = Router::normalize($url); + $this->Auth->request->url = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); @@ -843,7 +843,7 @@ class AuthTest extends CakeTestCase { $url = '/posts/edit/1'; $this->Auth->request = $this->Controller->request = new CakeRequest($url); $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->query = array('url' => Router::normalize($url)); + $this->Auth->request->url = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); @@ -856,7 +856,7 @@ class AuthTest extends CakeTestCase { $url = '/AuthTest/login'; $this->Auth->request = $this->Controller->request = new CakeRequest($url); $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->query['url'] = Router::normalize($url); + $this->Auth->request->url = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); @@ -965,11 +965,11 @@ class AuthTest extends CakeTestCase { $url = '/admin/auth_test/login'; $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->query['url'] = ltrim($url, '/'); + $this->Auth->request->url = ltrim($url, '/'); Router::setRequestInfo(array( array( 'pass' => array(), 'action' => 'admin_login', 'plugin' => null, 'controller' => 'auth_test', - 'admin' => true, 'url' => array('url' => $this->Auth->request->query['url']), + 'admin' => true, ), array( 'base' => null, 'here' => $url, diff --git a/cake/tests/cases/libs/controller/components/auth/crud_authorize.test.php b/cake/tests/cases/libs/controller/components/auth/crud_authorize.test.php index beee53fb9..92020b428 100644 --- a/cake/tests/cases/libs/controller/components/auth/crud_authorize.test.php +++ b/cake/tests/cases/libs/controller/components/auth/crud_authorize.test.php @@ -27,6 +27,8 @@ class CrudAuthorizeTest extends CakeTestCase { * @return void */ function setUp() { + Configure::write('Routing.prefixes', array()); + parent::setUp(); $this->controller = $this->getMock('Controller', array(), array(), '', false); $this->Acl = $this->getMock('AclComponent', array(), array(), '', false); diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index 5ff4b833e..dd637e622 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -1020,20 +1020,6 @@ class ControllerTest extends CakeTestCase { $this->assertidentical($TestController->data, $expected); } -/** - * testUnimplementedIsAuthorized method - * - * @expectedException PHPUnit_Framework_Error - * @access public - * @return void - */ - function testUnimplementedIsAuthorized() { - $request = new CakeRequest('controller_posts/index'); - - $TestController = new TestController($request); - $TestController->isAuthorized(); - } - /** * testValidateErrors method * diff --git a/cake/tests/cases/libs/controller/scaffold.test.php b/cake/tests/cases/libs/controller/scaffold.test.php index 031d8a0c5..54a67beff 100644 --- a/cake/tests/cases/libs/controller/scaffold.test.php +++ b/cake/tests/cases/libs/controller/scaffold.test.php @@ -771,11 +771,11 @@ class ScaffoldTest extends CakeTestCase { function testScaffoldChangingViewProperty() { $this->Controller->action = 'edit'; $this->Controller->theme = 'test_theme'; - $this->Controller->view = 'Theme'; + $this->Controller->viewClass = 'Theme'; $this->Controller->constructClasses(); $Scaffold = new TestScaffoldMock($this->Controller, $this->Controller->request); - $this->assertEqual($this->Controller->view, 'Scaffold'); + $this->assertEqual($this->Controller->viewClass, 'Scaffold'); } /** diff --git a/cake/tests/cases/libs/controller_test_case.test.php b/cake/tests/cases/libs/controller_test_case.test.php index 1ffb518c6..9e4feb4b7 100644 --- a/cake/tests/cases/libs/controller_test_case.test.php +++ b/cake/tests/cases/libs/controller_test_case.test.php @@ -388,7 +388,6 @@ class ControllerTestCaseTest extends CakeTestCase { 'return' => 'vars', 'method' => 'get', )); - $this->assertTrue(isset($result['params']['url']['url'])); $this->assertEqual(array_keys($result['params']['named']), array('var1', 'var2')); $result = $this->Case->testAction('/tests_apps_posts/url_var/gogo/val2', array( @@ -407,7 +406,6 @@ class ControllerTestCaseTest extends CakeTestCase { )); $this->assertTrue(isset($result['params']['url']['red'])); $this->assertTrue(isset($result['params']['url']['blue'])); - $this->assertTrue(isset($result['params']['url']['url'])); } /** diff --git a/cake/tests/cases/libs/debugger.test.php b/cake/tests/cases/libs/debugger.test.php index a76945566..e728fb5ea 100644 --- a/cake/tests/cases/libs/debugger.test.php +++ b/cake/tests/cases/libs/debugger.test.php @@ -227,6 +227,7 @@ class DebuggerTest extends CakeTestCase { View::$helpers = array View::$viewPath = "" View::$viewVars = array + View::$view = NULL View::$layout = "default" View::$layoutPath = NULL View::$autoLayout = true diff --git a/cake/tests/cases/libs/dispatcher.test.php b/cake/tests/cases/libs/dispatcher.test.php index 20fab006b..0f9a6bbbb 100644 --- a/cake/tests/cases/libs/dispatcher.test.php +++ b/cake/tests/cases/libs/dispatcher.test.php @@ -862,7 +862,6 @@ class DispatcherTest extends CakeTestCase { */ public function testPluginDispatch() { $_POST = array(); - $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; Router::reload(); $Dispatcher = new TestDispatcher(); @@ -879,7 +878,6 @@ class DispatcherTest extends CakeTestCase { 'pass' => array('home'), 'named' => array('param'=> 'value', 'param2'=> 'value2'), 'plugin'=> 'my_plugin', 'controller'=> 'some_pages', 'action'=> 'display', 'form'=> array(), - 'url'=> array('url'=> 'my_plugin/some_pages/home/param:value/param2:value2'), ); foreach ($expected as $key => $value) { $this->assertEqual($result[$key], $value, 'Value mismatch ' . $key . ' %'); @@ -889,12 +887,6 @@ class DispatcherTest extends CakeTestCase { $this->assertIdentical($controller->name, 'SomePages'); $this->assertIdentical($controller->params['controller'], 'some_pages'); $this->assertIdentical($controller->passedArgs, array('0' => 'home', 'param'=>'value', 'param2'=>'value2')); - - $expected = '/cake/repo/branches/1.2.x.x/my_plugin/some_pages/home/param:value/param2:value2'; - $this->assertIdentical($expected, $controller->here); - - $expected = '/cake/repo/branches/1.2.x.x'; - $this->assertIdentical($expected, $controller->base); } /** @@ -904,7 +896,7 @@ class DispatcherTest extends CakeTestCase { */ public function testAutomaticPluginDispatch() { $_POST = array(); - $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; + $_SERVER['SCRIPT_NAME'] = '/cake/repo/branches/1.2.x.x/index.php'; Router::reload(); $Dispatcher = new TestDispatcher(); @@ -1018,11 +1010,10 @@ class DispatcherTest extends CakeTestCase { 'prefix' => 'admin', 'admin' => true, 'form' => array(), - 'url' => array('url' => 'admin/articles_test'), 'return' => 1 ); foreach ($expected as $key => $value) { - $this->assertEqual($controller->params[$key], $expected[$key], 'Value mismatch ' . $key . ' %s'); + $this->assertEqual($controller->request[$key], $expected[$key], 'Value mismatch ' . $key . ' %s'); } }