mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #2785 from ADmad/2.4-view-return-value
Don't return `true` from view classes' render() method.
This commit is contained in:
commit
8cddd354d9
4 changed files with 6 additions and 9 deletions
|
@ -80,8 +80,7 @@ class MediaViewTest extends CakeTestCase {
|
|||
$this->MediaView->response->expects($this->once())
|
||||
->method('send');
|
||||
|
||||
$result = $this->MediaView->render();
|
||||
$this->assertTrue($result);
|
||||
$this->MediaView->render();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,8 +118,7 @@ class MediaViewTest extends CakeTestCase {
|
|||
$this->MediaView->response->expects($this->once())
|
||||
->method('send');
|
||||
|
||||
$result = $this->MediaView->render();
|
||||
$this->assertTrue($result);
|
||||
$this->MediaView->render();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1024,7 +1024,7 @@ class ViewTest extends CakeTestCase {
|
|||
$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 @@ class MediaView extends View {
|
|||
$this->response->compress();
|
||||
}
|
||||
$this->response->send();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -445,12 +445,12 @@ class View extends Object {
|
|||
*
|
||||
* @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', '');
|
||||
|
||||
|
|
Loading…
Reference in a new issue