From 81852c085f6cff146e9efa4af04d50bd175412fe Mon Sep 17 00:00:00 2001 From: uwetews Date: Tue, 20 Sep 2016 14:17:17 +0200 Subject: [PATCH] Test isset() 0n $smarty.foreache special variables --- .../TagTests/Foreach/CompileForeachTest.php | 10 ++++++++++ .../TagTests/Foreach/templates/036_foreach.tpl | 1 + .../TagTests/Foreach/templates/037_foreach.tpl | 1 + 3 files changed, 12 insertions(+) create mode 100644 tests/UnitTests/TemplateSource/TagTests/Foreach/templates/036_foreach.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/Foreach/templates/037_foreach.tpl diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php b/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php index d8ae5b2d..af831b0c 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php @@ -287,4 +287,14 @@ class CompileForeachTest extends PHPUnit_Smarty $this->assertEquals("a1a2a1a2", $this->smarty->fetch('035_foreach.tpl')); } + public function testForeachIsset_36() + { + $this->assertEquals("false", + $this->smarty->fetch('036_foreach.tpl')); + } + public function testForeachIsset_37() + { + $this->assertEquals("false", + $this->smarty->fetch('037_foreach.tpl')); + } } diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/036_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/036_foreach.tpl new file mode 100644 index 00000000..9aa2865c --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/036_foreach.tpl @@ -0,0 +1 @@ +{if !isset($smarty.foreach.name.index)}false{/if} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/037_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/037_foreach.tpl new file mode 100644 index 00000000..81ba1e51 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/037_foreach.tpl @@ -0,0 +1 @@ +{if false}no{elseif !isset($smarty.foreach.name.index)}false{/if} \ No newline at end of file