mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding tests for element callbacks.
This commit is contained in:
parent
32587c154c
commit
2e140a9fd3
2 changed files with 16 additions and 1 deletions
|
@ -360,7 +360,7 @@ class View extends Object {
|
|||
if ($callbacks) {
|
||||
$this->Helpers->trigger('beforeRender', array($file));
|
||||
}
|
||||
$element = $this->_render($file, array_merge($this->viewVars, $params), $loadHelpers);
|
||||
$element = $this->_render($file, array_merge($this->viewVars, $params));
|
||||
if ($callbacks) {
|
||||
$this->Helpers->trigger('afterRender', array($file, $element));
|
||||
}
|
||||
|
|
|
@ -475,6 +475,21 @@ class ViewTest extends CakeTestCase {
|
|||
$this->assertPattern('/non_existant_element/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that elements can have callbacks
|
||||
*
|
||||
*/
|
||||
function testElementCallbacks() {
|
||||
$this->getMock('HtmlHelper', array(), array($this->View), 'ElementCallbackMockHtmlHelper');
|
||||
$this->View->helpers = array('ElementCallbackMockHtml');
|
||||
$this->View->loadHelpers();
|
||||
|
||||
$this->View->ElementCallbackMockHtml->expects($this->at(0))->method('beforeRender');
|
||||
$this->View->ElementCallbackMockHtml->expects($this->at(1))->method('afterRender');
|
||||
|
||||
$this->View->element('test_element', array(), true);
|
||||
$this->mockObjects[] = $this->View->ElementCallbackMockHtml;
|
||||
}
|
||||
/**
|
||||
* testElementCacheHelperNoCache method
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue