Permalink
Browse files

Adding new callbacks into View.

  • Loading branch information...
1 parent 3fe7956 commit c49e261eba96e433fde6aea7257ccbcb3483fdee @markstory markstory committed Oct 8, 2011
Showing with 13 additions and 2 deletions.
  1. +10 −2 lib/Cake/Test/Case/View/ViewTest.php
  2. +3 −0 lib/Cake/View/View.php
@@ -586,11 +586,19 @@ public function testHelperCallbackTriggering() {
$View->Helpers->expects($this->at(0))->method('trigger')
->with('beforeRender', $this->anything());
$View->Helpers->expects($this->at(1))->method('trigger')
+ ->with('beforeRenderFile', $this->anything());
+ $View->Helpers->expects($this->at(2))->method('trigger')
+ ->with('afterRenderFile', $this->anything());
+ $View->Helpers->expects($this->at(3))->method('trigger')
->with('afterRender', $this->anything());
- $View->Helpers->expects($this->at(2))->method('trigger')
+ $View->Helpers->expects($this->at(4))->method('trigger')
->with('beforeLayout', $this->anything());
- $View->Helpers->expects($this->at(3))->method('trigger')
+ $View->Helpers->expects($this->at(5))->method('trigger')
+ ->with('beforeRenderFile', $this->anything());
+ $View->Helpers->expects($this->at(6))->method('trigger')
+ ->with('afterRenderFile', $this->anything());
+ $View->Helpers->expects($this->at(7))->method('trigger')
->with('afterLayout', $this->anything());
$View->render('index');
@@ -754,7 +754,10 @@ protected function _render($viewFile, $data = array()) {
$data = $this->viewVars;
}
$this->_current = $viewFile;
+
+ $this->Helpers->trigger('beforeRenderFile', array($viewFile));
$content = $this->_evaluate($viewFile, $data);
+ $this->Helpers->trigger('afterRenderFile', array($viewFile));
if (isset($this->_parents[$viewFile])) {
$this->_stack[] = $this->fetch('content');

0 comments on commit c49e261

Please sign in to comment.