Skip to content

Commit

Permalink
Added unit test to confirm #605 was actually fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskid committed Jan 8, 2021
1 parent e71481a commit d01f9cd
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,22 @@ public function testConstants7()
$tpl->assign('obj', new TestConst());
$this->assertEquals("yes", $this->smarty->fetch($tpl));
}

public function testConstantsUndefined()
{
$this->smarty->setErrorReporting(E_ALL & ~E_WARNING & ~E_NOTICE);
$tpl = $this->smarty->createTemplate('string:{$smarty.const.MYCONSTANT2}');
$this->assertEquals("", $this->smarty->fetch($tpl));
}

public function testConstantsUndefined2()
{
$this->smarty->setErrorReporting(E_ALL & ~E_WARNING & ~E_NOTICE);
$tpl = $this->smarty->createTemplate('eval:{$foo = MYCONSTANT2}{$foo}');
$this->assertEquals("MYCONSTANT2", $this->smarty->fetch($tpl));
}

public function testConstantsUndefined3()
{
$tpl = $this->smarty->createTemplate('eval:{if $smarty.const.MYCONSTANT2}{$smarty.const.MYCONSTANT2}{/if}');
$this->assertEquals("", $this->smarty->fetch($tpl));
}
}

0 comments on commit d01f9cd

Please sign in to comment.