Skip to content

Commit

Permalink
Fixing failing tests for ControllerTestCase.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 23, 2011
1 parent 04147ca commit 65d28f4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Cake/TestSuite/ControllerTestCase.php
Expand Up @@ -52,9 +52,9 @@ class ControllerTestDispatcher extends Dispatcher {
*
* @return Controller
*/
function _getController($request) {
function _getController($request, $response) {
if ($this->testController === null) {
$this->testController = parent::_getController($request);
$this->testController = parent::_getController($request, $response);
}
$this->testController->helpers = array_merge(array('InterceptContent'), $this->testController->helpers);
$this->testController->setRequest($request);
Expand Down Expand Up @@ -224,7 +224,7 @@ private function _testAction($url = '', $options = array()) {
}
$Dispatch->testController = $this->controller;
$Dispatch->response = $this->getMock('CakeResponse', array('send'));
$this->result = $Dispatch->dispatch($request, $params);
$this->result = $Dispatch->dispatch($request, $Dispatch->response, $params);
$this->controller = $Dispatch->testController;
if ($options['return'] != 'result') {
$this->vars = $this->controller->View->viewVars;
Expand Down Expand Up @@ -275,7 +275,9 @@ public function generate($controller, $mocks = array()) {
list($plugin, $name) = pluginSplit($controller);
$_controller = $this->getMock($name.'Controller', $mocks['methods'], array(), '', false);
$_controller->name = $name;
$_controller->__construct();
$request = $this->getMock('CakeRequest');
$response = $this->getMock('CakeResponse', array('_sendHeader'));
$_controller->__construct($request, $response);

$config = ClassRegistry::config('Model');
foreach ($mocks['models'] as $model => $methods) {
Expand Down Expand Up @@ -319,4 +321,4 @@ public function generate($controller, $mocks = array()) {
$this->controller = $_controller;
return $this->controller;
}
}
}

0 comments on commit 65d28f4

Please sign in to comment.