Browse files

Fixing failing tests for ControllerTestCase.

  • Loading branch information...
1 parent 04147ca commit 65d28f4c73140f0bb5d1e9f8f2319372fe501f0f @markstory markstory committed with markstory Jul 3, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/Cake/TestSuite/ControllerTestCase.php
View
12 lib/Cake/TestSuite/ControllerTestCase.php
@@ -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);
@@ -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;
@@ -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) {
@@ -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.