From dcb0d4be631b02503a66ebeb21384bd53828d6a1 Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 27 Jan 2016 04:44:05 +0100 Subject: [PATCH] add {extends} tests with relative path --- .../BockExtend/CompileBlockExtendsTest.php | 23 +++++++++++++++++++ .../templates/sub/030_child_nested_rel.tpl | 6 +++++ .../sub/030_grandchild_nested_rel.tpl | 2 ++ 3 files changed, 31 insertions(+) create mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_child_nested_rel.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_grandchild_nested_rel.tpl diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php index 6507b479..b99b3d63 100644 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php @@ -850,6 +850,29 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty $this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure'); } + /** + * test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache} + * + * @runInSeparateProcess + * @preserveGlobalState disabled + * @dataProvider data + */ + public function testCompileBlockGrandChildNestedRelative_030($caching, $merge, $testNumber, $compileTestNumber, + $renderTestNumber, $testName) + { + $this->smarty->registerFilter('pre', array($this, 'compiledPrefilter')); + $this->smarty->assign('test', $testNumber); + $this->smarty->setCaching($caching); + $this->smarty->setMergeCompiledIncludes($merge); + if ($merge) { + $this->smarty->setCompileId(1); + } + $result = $this->smarty->fetch('sub/030_grandchild_nested_rel.tpl'); + $this->assertContains('child pre -grandchild content- child post', $result, $testName . ' - content'); + $this->assertContains('include:' . $testNumber, $result, $testName . ' - content 2'); + $this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, + $testName . ' - fetch() failure'); + } public function data() { diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_child_nested_rel.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_child_nested_rel.tpl new file mode 100644 index 00000000..7a56aa37 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_child_nested_rel.tpl @@ -0,0 +1,6 @@ +{extends file='../030_parent.tpl'} +{block name='content1'} + {block name='content2'} + child pre {$smarty.block.child} child post {include file='../030_include.tpl' nocache} + {/block} +{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_grandchild_nested_rel.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_grandchild_nested_rel.tpl new file mode 100644 index 00000000..79060995 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/sub/030_grandchild_nested_rel.tpl @@ -0,0 +1,2 @@ +{extends file='./030_child_nested_rel.tpl'} +{block name='content2'}-grandchild content-{/block}