Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 4b65d72

Browse files
committed
add test for chained prepend
1 parent 433963f commit 4b65d72

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,26 @@ public function testCompileBlockGrandChildPrepend_013($caching, $merge, $testNum
292292
$this->smarty->compile_id = 1;
293293
}
294294
$result = $this->smarty->fetch('013_grandchild_prepend.tpl');
295-
$this->assertContains('grandchild prepend - Page Title', $result, $testName . ' - content');
295+
$this->assertContains('grandchild prepend - child', $result, $testName . ' - content');
296+
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
297+
}
298+
/**
299+
* test grandchild/child/parent template chain prepend
300+
* @runInSeparateProcess
301+
* @preserveGlobalState disabled
302+
* @dataProvider data
303+
*/
304+
public function testCompileBlockGrandChildPrepend_013_2($caching, $merge, $testNumber, $compileTestNumber, $renderTestNumber, $testName)
305+
{
306+
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
307+
$this->smarty->assign('test', $testNumber);
308+
$this->smarty->caching = $caching;
309+
$this->smarty->merge_compiled_includes = $merge;
310+
if ($merge) {
311+
$this->smarty->compile_id = 1;
312+
}
313+
$result = $this->smarty->fetch('013_2_grandchild_prepend.tpl');
314+
$this->assertContains('grandchild prepend - child prepend - parent', $result, $testName . ' - content');
296315
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
297316
}
298317

@@ -446,7 +465,7 @@ public function testCompileBlockStartSubTemplates_020($caching, $merge, $testNum
446465

447466
/**
448467
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
449-
* @runInSeparateProcess
468+
* @run InSeparateProcess
450469
* @preserveGlobalState disabled
451470
* @dataProvider data
452471
*/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{extends file='013_parent.tpl'}
2+
{block name='title' prepend}child prepend - {/block}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{extends file='013_2_child_prepend.tpl'}
2+
{block name='title' prepend}grandchild prepend - {/block}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{extends file='013_parent.tpl'}
2-
{block name='title'}Page Title{/block}
2+
{block name='title'}child{/block}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:{$test nocache} compiled:# rendered:{$test}
2-
{block name='title'}Default Title{/block}
2+
{block name='title'}parent{/block}

0 commit comments

Comments
 (0)