Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix issue with Controller::setAction()
Calling setAction did not modify which view file was
rendered.  This was a regression with 1.3

Fixes #2212
  • Loading branch information
markstory committed Nov 4, 2011
1 parent e95d675 commit a929951
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -805,6 +805,7 @@ public function set($one, $two = null) {
*/
public function setAction($action) {
$this->request->action = $action;
$this->view = $action;
$args = func_get_args();
unset($args[0]);
return call_user_func_array(array(&$this, $action), $args);
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Test/Case/Controller/ControllerTest.php
Expand Up @@ -967,7 +967,8 @@ public function testSetAction() {
$TestController = new TestController($request);
$TestController->setAction('index', 1, 2);
$expected = array('testId' => 1, 'test2Id' => 2);
$this->assertidentical($TestController->data, $expected);
$this->assertSame($expected, $TestController->request->data);
$this->assertSame('index', $TestController->view);
}

/**
Expand Down

0 comments on commit a929951

Please sign in to comment.