add test for chained prepend

This commit is contained in:
uwetews
2015-12-18 03:58:53 +01:00
parent 3d7a1d57dc
commit e9e473da65
5 changed files with 27 additions and 4 deletions

View File

@@ -292,7 +292,26 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
$this->smarty->compile_id = 1; $this->smarty->compile_id = 1;
} }
$result = $this->smarty->fetch('013_grandchild_prepend.tpl'); $result = $this->smarty->fetch('013_grandchild_prepend.tpl');
$this->assertContains('grandchild prepend - Page Title', $result, $testName . ' - content'); $this->assertContains('grandchild prepend - child', $result, $testName . ' - content');
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
}
/**
* test grandchild/child/parent template chain prepend
* @runInSeparateProcess
* @preserveGlobalState disabled
* @dataProvider data
*/
public function testCompileBlockGrandChildPrepend_013_2($caching, $merge, $testNumber, $compileTestNumber, $renderTestNumber, $testName)
{
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
$this->smarty->assign('test', $testNumber);
$this->smarty->caching = $caching;
$this->smarty->merge_compiled_includes = $merge;
if ($merge) {
$this->smarty->compile_id = 1;
}
$result = $this->smarty->fetch('013_2_grandchild_prepend.tpl');
$this->assertContains('grandchild prepend - child prepend - parent', $result, $testName . ' - content');
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure'); $this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
} }

View File

@@ -0,0 +1,2 @@
{extends file='013_parent.tpl'}
{block name='title' prepend}child prepend - {/block}

View File

@@ -0,0 +1,2 @@
{extends file='013_2_child_prepend.tpl'}
{block name='title' prepend}grandchild prepend - {/block}

View File

@@ -1,2 +1,2 @@
{extends file='013_parent.tpl'} {extends file='013_parent.tpl'}
{block name='title'}Page Title{/block} {block name='title'}child{/block}

View File

@@ -1,2 +1,2 @@
test:{$test nocache} compiled:# rendered:{$test} test:{$test nocache} compiled:# rendered:{$test}
{block name='title'}Default Title{/block} {block name='title'}parent{/block}