Skip to content

Commit

Permalink
Fixing failing tests, and issues around Controller::$view not getting
Browse files Browse the repository at this point in the history
set properly.
  • Loading branch information
markstory committed Mar 9, 2011
1 parent de57802 commit c8f33b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions cake/libs/controller/controller.php
Expand Up @@ -403,15 +403,22 @@ public function __set($name, $value) {

/**
* Sets the request objects and configures a number of controller properties
* based on the contents of the request.
* based on the contents of the request. The properties that get set are
*
* - $this->request - To the $request parameter
* - $this->plugin - To the $request->params['plugin']
* - $this->view - To the $request->params['action']
* - $this->autoLayout - To the false if $request->params['bare']; is set.
* - $this->autoRender - To false if $request->params['return'] == 1
* - $this->passedArgs - The the combined results of params['named'] and params['pass]
*
* @param CakeRequest $request
* @return void
*/
public function setRequest(CakeRequest $request) {
$this->request = $request;
$this->plugin = isset($request->params['plugin']) ? $request->params['plugin'] : null;

$this->view = isset($request->params['action']) ? $request->params['action'] : null;
if (isset($request->params['pass']) && isset($request->params['named'])) {
$this->passedArgs = array_merge($request->params['pass'], $request->params['named']);
}
Expand Down
3 changes: 1 addition & 2 deletions cake/libs/route/redirect_route.php
Expand Up @@ -68,8 +68,7 @@ public function parse($url) {
$redirect = $this->redirect[0];
}
if (isset($this->options['persist']) && is_array($redirect)) {
$argOptions['context'] = array('action' => $redirect['action'], 'controller' => $redirect['controller']);
$redirect += Router::getArgs($params['_args_'], $argOptions) + array('url' => array());
$redirect += array('named' => $params['named'], 'pass' => $params['pass'], 'url' => array());
$redirect = Router::reverse($redirect);
}
$status = 301;
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/controller/scaffold.test.php
Expand Up @@ -485,7 +485,7 @@ function testViewScaffold() {
function testEditScaffold() {
$this->Controller->request->base = '';
$this->Controller->request->webroot = '/';
$this->Controller->request->here = '/scaffold_mock';
$this->Controller->request->here = '/scaffold_mock/edit/1';

$params = array(
'plugin' => null,
Expand Down
1 change: 1 addition & 0 deletions cake/tests/lib/controller_test_case.php
Expand Up @@ -171,6 +171,7 @@ public function __call($name, $arguments) {
* Tests a controller action.
*
* ### Options:
*
* - `data` POST or GET data to pass
* - `method` POST or GET
*
Expand Down

3 comments on commit c8f33b7

@mamchenkov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still seems to be broken for views with prefixes.

@markstory
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Is this comment related to the issue on lighthouse?

@mamchenkov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it like the problem in ticket #1580 (lighthouse, not github). I am also using a few prefixes, in the project based on 2.0.

Please sign in to comment.