From 66f6c54281e5f20904ecbf336996a3bdf2628c93 Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 13 Apr 2016 03:30:32 +0200 Subject: [PATCH] Update {extends} test --- .../TagTests/BockExtend/CompileBlockExtendsTest.php | 12 ++++++++++++ .../TagTests/BockExtend/templates/032_child.tpl | 3 +++ .../BockExtend/templates/032_included_child.tpl | 3 +++ .../BockExtend/templates/032_included_parent.tpl | 2 ++ .../TagTests/BockExtend/templates/032_parent.tpl | 2 ++ 5 files changed, 22 insertions(+) create mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_child.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_child.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_parent.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_parent.tpl diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php index b99b3d63..903751e6 100644 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php @@ -909,4 +909,16 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty $this->smarty->assign('bar', 'bar'); $this->assertContains('bar', $this->smarty->fetch('031_post_filter.tpl')); } + /* + * Test new inheritance root in outermost include + */ + public function testInclude_032() + { + $result = $this->smarty->fetch('032_child.tpl'); + $this->assertContains('foo in 032_child.tpl', $result); + $this->assertContains('bar in 032_included_child.tpl', $result); + $this->assertContains('foo in 032_included_parent.tpl', $result); + $this->assertNotContains('bar in 032_included_parent.tpl', $result); + $this->assertNotContains('foo in 032_parent.tpl', $result); + } } diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_child.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_child.tpl new file mode 100644 index 00000000..9ec7d00b --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_child.tpl @@ -0,0 +1,3 @@ +{extends "032_parent.tpl"} + +{block "foo"}foo in 032_child.tpl{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_child.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_child.tpl new file mode 100644 index 00000000..471ec2a6 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_child.tpl @@ -0,0 +1,3 @@ +{extends file="032_included_parent.tpl"} + +{block "bar"}bar in 032_included_child.tpl{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_parent.tpl new file mode 100644 index 00000000..db12e3c6 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_included_parent.tpl @@ -0,0 +1,2 @@ +{block "bar"}bar in 032_included_parent.tpl{/block} +{block "foo"}foo in 032_included_parent.tpl{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_parent.tpl new file mode 100644 index 00000000..f55f6e7a --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/032_parent.tpl @@ -0,0 +1,2 @@ +{include file="032_included_child.tpl"} +{block "foo"}foo in 032_parent.tpl{/block} \ No newline at end of file