Add unit tests for short hand template function definition and shorthand template function calls.

This commit is contained in:
Simon Wisselink
2024-10-06 22:01:17 +02:00
parent cd58df7a26
commit a1b4c9c551
4 changed files with 30 additions and 0 deletions

View File

@ -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'));
}
}

View File

@ -0,0 +1,2 @@
{function blah}gribus{/function}
{call name=blah}

View File

@ -0,0 +1,2 @@
{function name=blah}gribus{/function}
{blah}

View File

@ -0,0 +1,2 @@
{function blah}gribus{/function}
{blah}