mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
Added unit test for issue 28 and 29
This commit is contained in:
@@ -376,4 +376,19 @@ class ConfigVarTest extends PHPUnit_Smarty
|
|||||||
$this->smarty->configLoad('db4:foo.conf');
|
$this->smarty->configLoad('db4:foo.conf');
|
||||||
$this->assertEquals("bar", $this->smarty->fetch('eval:{#foo#}'));
|
$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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -74,4 +74,14 @@ class ConstantsTest extends PHPUnit_Smarty
|
|||||||
$tpl->assign('obj', new TestConst());
|
$tpl->assign('obj', new TestConst());
|
||||||
$this->assertEquals("yes", $this->smarty->fetch($tpl));
|
$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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user