diff --git a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php index 6d1da7f5..62747ba2 100644 --- a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php @@ -438,7 +438,31 @@ class CompileFunctionTest extends PHPUnit_Smarty */ public function testIllegalFunctionName() { $this->expectException(SmartyCompilerException::class); - $this->smarty->fetch('string:{function name=\'rce(){};echo "hi";function \'}{/function}'); + $this->smarty->fetch('string:{function name=\'rce(){};echo "hi";function \'}{/function}'); + } + + /** + * test shorthand function definition with regular call + */ + public function testShorthand1() + { + $this->assertEquals("gribus", $this->smarty->fetch('shorthand1.tpl')); + } + + /** + * test normal function definition with shorthand call + */ + public function testShorthand2() + { + $this->assertEquals("gribus", $this->smarty->fetch('shorthand2.tpl')); + } + + /** + * test shorthand function definition with shorthand call + */ + public function testShorthand3() + { + $this->assertEquals("gribus", $this->smarty->fetch('shorthand3.tpl')); } } diff --git a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand1.tpl b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand1.tpl new file mode 100644 index 00000000..1ca50d70 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand1.tpl @@ -0,0 +1,2 @@ +{function blah}gribus{/function} +{call name=blah} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand2.tpl b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand2.tpl new file mode 100644 index 00000000..2901a3d5 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand2.tpl @@ -0,0 +1,2 @@ +{function name=blah}gribus{/function} +{blah} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand3.tpl b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand3.tpl new file mode 100644 index 00000000..61be2255 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/templates/shorthand3.tpl @@ -0,0 +1,2 @@ +{function blah}gribus{/function} +{blah} \ No newline at end of file