add test for this

This commit is contained in:
Simon Wisselink
2024-12-23 01:25:54 +01:00
parent da49620e26
commit 7c33345d21
3 changed files with 12 additions and 0 deletions

View File

@@ -83,6 +83,16 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty
$this->assertEquals($e1, $e2); $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() { public function testUndefinedSimpleVar() {
$this->smarty->muteUndefinedOrNullWarnings(); $this->smarty->muteUndefinedOrNullWarnings();
$tpl = $this->smarty->createTemplate('string:a{if $undef}def{/if}b'); $tpl = $this->smarty->createTemplate('string:a{if $undef}def{/if}b');

View File

@@ -0,0 +1 @@
undefined = {if empty($foo)}{/if}

View File

@@ -0,0 +1 @@
undefined = {if isset($foo)}{/if}