diff --git a/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php b/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php index 2b1c6604..e5c6446d 100644 --- a/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php +++ b/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php @@ -83,6 +83,16 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty $this->assertEquals($e1, $e2); } + public function testNoErrorForIssetOrEmpty() + { + $this->smarty->error_unassigned = true; + $e1 = error_reporting(); + $this->assertEquals('undefined = ', $this->smarty->fetch('001_isset.tpl')); + $this->assertEquals('undefined = ', $this->smarty->fetch('001_empty.tpl')); + $e2 = error_reporting(); + $this->assertEquals($e1, $e2); + } + public function testUndefinedSimpleVar() { $this->smarty->muteUndefinedOrNullWarnings(); $tpl = $this->smarty->createTemplate('string:a{if $undef}def{/if}b'); diff --git a/tests/UnitTests/A_2/UndefinedTemplateVar/templates/001_empty.tpl b/tests/UnitTests/A_2/UndefinedTemplateVar/templates/001_empty.tpl new file mode 100644 index 00000000..54bbaa7f --- /dev/null +++ b/tests/UnitTests/A_2/UndefinedTemplateVar/templates/001_empty.tpl @@ -0,0 +1 @@ +undefined = {if empty($foo)}{/if} \ No newline at end of file diff --git a/tests/UnitTests/A_2/UndefinedTemplateVar/templates/001_isset.tpl b/tests/UnitTests/A_2/UndefinedTemplateVar/templates/001_isset.tpl new file mode 100644 index 00000000..d96aac12 --- /dev/null +++ b/tests/UnitTests/A_2/UndefinedTemplateVar/templates/001_isset.tpl @@ -0,0 +1 @@ +undefined = {if isset($foo)}{/if} \ No newline at end of file