Skip to content

Commit

Permalink
Fixing more failing tests caused by requestAction
Browse files Browse the repository at this point in the history
and changes in Controller::__construct.
  • Loading branch information
markstory committed Jul 23, 2011
1 parent 2141b49 commit 173e043
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 34 deletions.
3 changes: 0 additions & 3 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Core/Object.php
Expand Up @@ -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);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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(
Expand Down
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Controller/PagesControllerTest.php
Expand Up @@ -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');
Expand Down

0 comments on commit 173e043

Please sign in to comment.