This repository was archived by the owner on Apr 13, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
TemplateSource/ValueTests/ConstantTests Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -376,4 +376,19 @@ public function testConfigResourceDb4()
376376 $ this ->smarty ->configLoad ('db4:foo.conf ' );
377377 $ this ->assertEquals ("bar " , $ this ->smarty ->fetch ('eval:{#foo#} ' ));
378378 }
379+ public function testConfigUndefinedSilent ()
380+ {
381+ $ this ->assertEquals ("" , $ this ->smarty ->fetch ('eval:{#foo#} ' ));
382+ }
383+
384+ public function testConfigUndefinedNotice ()
385+ {
386+ $ this ->smarty ->error_unassigned = true ;
387+ try {
388+ $ this ->assertEquals ("" , $ this ->smarty ->fetch ('eval:{#foo#} ' ));
389+ }
390+ catch (Exception $ e ) {
391+ $ this ->assertEquals ('Undefined variable: foo ' , $ e ->getMessage ());
392+ }
393+ }
379394}
Original file line number Diff line number Diff line change @@ -74,4 +74,14 @@ public function testConstants7()
7474 $ tpl ->assign ('obj ' , new TestConst ());
7575 $ this ->assertEquals ("yes " , $ this ->smarty ->fetch ($ tpl ));
7676 }
77+ public function testConstantsUndefined ()
78+ {
79+ $ tpl = $ this ->smarty ->createTemplate ('string:{$smarty.const.MYCONSTANT2} ' );
80+ $ this ->assertEquals ("" , $ this ->smarty ->fetch ($ tpl ));
81+ }
82+ public function testConstantsUndefined2 ()
83+ {
84+ $ tpl = $ this ->smarty ->createTemplate ('eval:{$foo = MYCONSTANT2}{$foo} ' );
85+ $ this ->assertEquals ("MYCONSTANT2 " , $ this ->smarty ->fetch ($ tpl ));
86+ }
7787}
You can’t perform that action at this time.
0 commit comments