Skip to content

Commit c8f33b7

Browse files
committed
Fixing failing tests, and issues around Controller::$view not getting
set properly.
1 parent de57802 commit c8f33b7

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

cake/libs/controller/controller.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,22 @@ public function __set($name, $value) {
403403

404404
/**
405405
* Sets the request objects and configures a number of controller properties
406-
* based on the contents of the request.
406+
* based on the contents of the request. The properties that get set are
407+
*
408+
* - $this->request - To the $request parameter
409+
* - $this->plugin - To the $request->params['plugin']
410+
* - $this->view - To the $request->params['action']
411+
* - $this->autoLayout - To the false if $request->params['bare']; is set.
412+
* - $this->autoRender - To false if $request->params['return'] == 1
413+
* - $this->passedArgs - The the combined results of params['named'] and params['pass]
407414
*
408415
* @param CakeRequest $request
409416
* @return void
410417
*/
411418
public function setRequest(CakeRequest $request) {
412419
$this->request = $request;
413420
$this->plugin = isset($request->params['plugin']) ? $request->params['plugin'] : null;
414-
421+
$this->view = isset($request->params['action']) ? $request->params['action'] : null;
415422
if (isset($request->params['pass']) && isset($request->params['named'])) {
416423
$this->passedArgs = array_merge($request->params['pass'], $request->params['named']);
417424
}

cake/libs/route/redirect_route.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public function parse($url) {
6868
$redirect = $this->redirect[0];
6969
}
7070
if (isset($this->options['persist']) && is_array($redirect)) {
71-
$argOptions['context'] = array('action' => $redirect['action'], 'controller' => $redirect['controller']);
72-
$redirect += Router::getArgs($params['_args_'], $argOptions) + array('url' => array());
71+
$redirect += array('named' => $params['named'], 'pass' => $params['pass'], 'url' => array());
7372
$redirect = Router::reverse($redirect);
7473
}
7574
$status = 301;

cake/tests/cases/libs/controller/scaffold.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ function testViewScaffold() {
485485
function testEditScaffold() {
486486
$this->Controller->request->base = '';
487487
$this->Controller->request->webroot = '/';
488-
$this->Controller->request->here = '/scaffold_mock';
488+
$this->Controller->request->here = '/scaffold_mock/edit/1';
489489

490490
$params = array(
491491
'plugin' => null,

cake/tests/lib/controller_test_case.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public function __call($name, $arguments) {
171171
* Tests a controller action.
172172
*
173173
* ### Options:
174+
*
174175
* - `data` POST or GET data to pass
175176
* - `method` POST or GET
176177
*

0 commit comments

Comments
 (0)