From 173e043eaffadc9c5a7c6b4dd7f0e560e8ada223 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 3 Jul 2011 15:02:46 -0400 Subject: [PATCH] Fixing more failing tests caused by requestAction and changes in Controller::__construct. --- lib/Cake/Controller/Controller.php | 3 --- lib/Cake/Core/Object.php | 2 +- .../Component/AuthComponentTest.php | 10 ++++---- .../Component/RequestHandlerComponentTest.php | 24 ------------------- .../Case/Controller/PagesControllerTest.php | 2 +- 5 files changed, 7 insertions(+), 34 deletions(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 66619a31e0e..1a169b60b86 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -520,9 +520,6 @@ public function constructClasses() { * @return CakeResponse */ public function getResponse() { - if (empty($this->response)) { - $this->response = new $this->_responseClass(array('charset' => Configure::read('App.encoding'))); - } return $this->response; } diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index 181a9baa4fd..35c5a8c3808 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -87,7 +87,7 @@ public function requestAction($url, $extra = array()) { } $dispatcher = new Dispatcher(); - return $dispatcher->dispatch($request, $extra); + return $dispatcher->dispatch($request, new CakeResponse(), $extra); } /** diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index fac3ece7844..abfb9059b28 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -122,12 +122,12 @@ class AuthTestController extends Controller { * @access private * @return void */ - function __construct($request) { + function __construct($request, $response) { $request->addParams(Router::parse('/auth_test')); $request->here = '/auth_test'; $request->webroot = '/'; Router::setRequestInfo($request); - parent::__construct($request); + parent::__construct($request, $response); } /** @@ -339,7 +339,7 @@ public function setUp() { $request = new CakeRequest(null, false); - $this->Controller = new AuthTestController($request); + $this->Controller = new AuthTestController($request, $this->getMock('CakeResponse')); $collection = new ComponentCollection(); $collection->init($this->Controller); @@ -960,7 +960,7 @@ public function testAjaxLogin() { ob_start(); $Dispatcher = new Dispatcher(); - $Dispatcher->dispatch(new CakeRequest('/ajax_auth/add'), array('return' => 1)); + $Dispatcher->dispatch(new CakeRequest('/ajax_auth/add'), new CakeResponse(), array('return' => 1)); $result = ob_get_clean(); $this->assertEqual("Ajax!\nthis is the test element", str_replace("\r\n", "\n", $result)); @@ -1024,7 +1024,7 @@ public function testShutDown() { */ public function testComponentSettings() { $request = new CakeRequest(null, false); - $this->Controller = new AuthTestController($request); + $this->Controller = new AuthTestController($request, $this->getMock('CakeResponse')); $this->Controller->components = array( 'Auth' => array( diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index c4b7e69352b..94b1da5f5a3 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -77,30 +77,6 @@ public function ajax2_layout() { } } -/** - * RequestHandlerTestDisabledController class - * - * @package cake.tests.cases.libs.controller.components - */ -class RequestHandlerTestDisabledController extends Controller { - -/** - * uses property - * - * @var mixed null - * @access public - */ - public $uses = null; - -/** - * beforeFilter method - * - * @return void - */ - public function beforeFilter() { - $this->RequestHandler->enabled = false; - } -} /** * RequestHandlerComponentTest class diff --git a/lib/Cake/Test/Case/Controller/PagesControllerTest.php b/lib/Cake/Test/Case/Controller/PagesControllerTest.php index cfefc8eb1bd..c83e95c925a 100644 --- a/lib/Cake/Test/Case/Controller/PagesControllerTest.php +++ b/lib/Cake/Test/Case/Controller/PagesControllerTest.php @@ -48,7 +48,7 @@ public function testDisplay() { CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS ) )); - $Pages = new PagesController(new CakeRequest(null, false)); + $Pages = new PagesController(new CakeRequest(null, false), new CakeResponse()); $Pages->viewPath = 'Posts'; $Pages->display('index');