Skip to content
Permalink
Browse files

Removing Controller::output property and refactoring methods to not u…

…se it. CakeResponse::body() should be used instead
  • Loading branch information...
lorenzo committed Aug 1, 2010
1 parent 1b58084 commit 0824348db16d4865d3c0a8072bbd1dc9a43c1a24
@@ -231,15 +231,6 @@ class Controller extends Object {
*/
public $ext = '.ctp';
/**
* The output of the requested action. Contains either a variable
* returned from the action, or the data of the rendered view;
* You can use this var in child controllers' afterFilter() callbacks to alter output.
*
* @var string
*/
public $output = null;
/**
* Automatically set to the name of a plugin.
*
@@ -835,9 +826,7 @@ public function render($action = null, $layout = null, $file = null) {
}
$this->autoRender = false;
$this->output .= $View->render($action, $layout, $file);
return $this->output;
return $View->render($action, $layout, $file);
}
/**
@@ -888,7 +877,7 @@ public function flash($message, $url, $pause = 1, $layout = 'flash') {
$this->set('message', $message);
$this->set('pause', $pause);
$this->set('page_title', $message);
$this->render(false, $layout);
$this->response->body($this->render(false, $layout));
}
/**
@@ -1464,6 +1464,7 @@ public function testFullPageCachingDispatch() {
), true);
$dispatcher = new TestDispatcher();
$dispatcher->response = $this->getMock('CakeResponse', array('_sendHeader'));
$url = '/';
ob_start();
@@ -1599,6 +1600,7 @@ function testCachedRegisteringViewObject() {
));
$dispatcher = new TestDispatcher();
$dispatcher->response = $this->getMock('CakeResponse', array('_sendHeader'));
$dispatcher->base = false;
$url = 'test_cached_pages/cache_form';
@@ -856,9 +856,9 @@ function testPaginateOrderVirtualField() {
function testFlash() {
$request = new CakeRequest('controller_posts/index');
$Controller = new Controller($request);
$Controller = new Controller($request, $this->getMock('CakeResponse', array('_sendHeader')));
$Controller->flash('this should work', '/flash');
$result = $Controller->output;
$result = $Controller->response->body();
$expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -880,9 +880,9 @@ function testFlash() {
$this->assertEqual($result, $expected);
App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)));
$Controller = new Controller();
$Controller = new Controller(null, $this->getMock('CakeResponse', array('_sendHeader')));
$Controller->flash('this should work', '/flash', 1, 'ajax2');
$result = $Controller->output;
$result = $Controller->response->body();
$this->assertPattern('/Ajax!/', $result);
App::build();
}

0 comments on commit 0824348

Please sign in to comment.
You can’t perform that action at this time.