Skip to content
Permalink
Browse files

Don't return `true` from view classes' render() method.

It cause's Controller:render() to set the response body as `true`.

Refs #2780
  • Loading branch information...
ADmad committed Feb 5, 2014
1 parent 2cd7212 commit d9489257d34de4fdfd3ea57be908269a4ab56c87
@@ -80,8 +80,7 @@ public function testRender() {
$this->MediaView->response->expects($this->once())
->method('send');
$result = $this->MediaView->render();
$this->assertTrue($result);
$this->MediaView->render();
}
/**
@@ -119,8 +118,7 @@ public function testRenderCachingAndName() {
$this->MediaView->response->expects($this->once())
->method('send');
$result = $this->MediaView->render();
$this->assertTrue($result);
$this->MediaView->render();
}
/**
@@ -1024,7 +1024,7 @@ public function testRender() {
$this->assertRegExp("/<title>yo what up<\/title>/", $result);
$this->assertRegExp("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result);
$this->assertTrue($View->render(false, 'flash'));
$this->assertNull($View->render(false, 'flash'));
$this->PostsController->helpers = array('Session', 'Cache', 'Html');
$this->PostsController->constructClasses();
@@ -62,7 +62,7 @@ class MediaView extends View {
*
* @param string $view Not used
* @param string $layout Not used
* @return boolean
* @return void
*/
public function render($view = null, $layout = null) {
$name = $download = $id = $modified = $path = $cache = $mimeType = $compress = null;
@@ -94,7 +94,6 @@ public function render($view = null, $layout = null) {
$this->response->compress();
}
$this->response->send();
return true;
}
}
@@ -445,12 +445,12 @@ public function elementExists($name) {
*
* @param string $view Name of view file to use
* @param string $layout Layout to use.
* @return string Rendered Element
* @return string|null Rendered content or null if content already rendered and returned earlier.
* @throws CakeException If there is an error in the view.
*/
public function render($view = null, $layout = null) {
if ($this->hasRendered) {
return true;
return;
}
$this->Blocks->set('content', '');

0 comments on commit d948925

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