Add block functions to the template, so they can be evaluated lazily.
Fixes #264
This commit is contained in:
@@ -467,6 +467,23 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
$this->assertEquals('<1><2><3>', $tpl->render($data));
|
||||
}
|
||||
|
||||
public function testInheritanceWithLazyEvaluationAndSections()
|
||||
{
|
||||
$partials = array(
|
||||
'parent' => '{{#items}}{{$value}}\n\nignored {{.}} {{#more}} there is more {{/more}}\n\n{{/value}}{{/items}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
|
||||
$tpl = $this->mustache->loadTemplate(
|
||||
'{{<parent}}\n\n\n{{$value}}<{{ . }}>{{#more}} there is less {{/more}}{{/value}}\n\n{{/parent}}'
|
||||
);
|
||||
|
||||
$data = array('items' => array(1, 2, 3), 'more' => 'stuff');
|
||||
|
||||
$this->assertEquals('<1> there is less <2> there is less <3> there is less ', $tpl->render($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getIllegalInheritanceExamples
|
||||
* @expectedException Mustache_Exception_SyntaxException
|
||||
|
||||
Reference in New Issue
Block a user