diff --git a/tests/UnitTests/ConfigFileTests/ConfigVarTest.php b/tests/UnitTests/ConfigFileTests/ConfigVarTest.php index 9638535d..89c5ddac 100644 --- a/tests/UnitTests/ConfigFileTests/ConfigVarTest.php +++ b/tests/UnitTests/ConfigFileTests/ConfigVarTest.php @@ -376,4 +376,19 @@ class ConfigVarTest extends PHPUnit_Smarty $this->smarty->configLoad('db4:foo.conf'); $this->assertEquals("bar", $this->smarty->fetch('eval:{#foo#}')); } + public function testConfigUndefinedSilent() + { + $this->assertEquals("", $this->smarty->fetch('eval:{#foo#}')); + } + + public function testConfigUndefinedNotice() + { + $this->smarty->error_unassigned = true; + try { + $this->assertEquals("", $this->smarty->fetch('eval:{#foo#}')); + } + catch (Exception $e) { + $this->assertEquals('Undefined variable: foo', $e->getMessage()); + } + } } diff --git a/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php b/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php index e4c4663f..6a1885e7 100644 --- a/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php +++ b/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php @@ -74,4 +74,14 @@ class ConstantsTest extends PHPUnit_Smarty $tpl->assign('obj', new TestConst()); $this->assertEquals("yes", $this->smarty->fetch($tpl)); } + public function testConstantsUndefined() + { + $tpl = $this->smarty->createTemplate('string:{$smarty.const.MYCONSTANT2}'); + $this->assertEquals("", $this->smarty->fetch($tpl)); + } + public function testConstantsUndefined2() + { + $tpl = $this->smarty->createTemplate('eval:{$foo = MYCONSTANT2}{$foo}'); + $this->assertEquals("MYCONSTANT2", $this->smarty->fetch($tpl)); + } }