diff options
| author | Simon Wisselink <s.wisselink@iwink.nl> | 2024-10-06 22:01:17 +0200 |
|---|---|---|
| committer | Simon Wisselink <s.wisselink@iwink.nl> | 2024-10-06 22:06:39 +0200 |
| commit | a1b4c9c551d01ff63220f053966c7aaa9053f89d (patch) | |
| tree | 6552c7f1423e321f839868eb1dfcb34f85e4048a /tests | |
| parent | cd58df7a2603b7d925e5db5c9d50f10987695fd3 (diff) | |
| download | smarty-a1b4c9c551d01ff63220f053966c7aaa9053f89d.tar.gz smarty-a1b4c9c551d01ff63220f053966c7aaa9053f89d.tar.bz2 smarty-a1b4c9c551d01ff63220f053966c7aaa9053f89d.zip | |
Add unit tests for short hand template function definition and shorthand template function calls.
Diffstat (limited to 'tests')
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php index 863ca6c4..16892ed0 100644 --- a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php @@ -442,4 +442,28 @@ class CompileFunctionTest extends PHPUnit_Smarty $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 |
