Skip to content

Commit

Permalink
Add test coverage of unnamed arguments in compiler plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
gkreitz authored and Gunnar Kreitz committed Jan 17, 2025
1 parent b85616c commit ff12140
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testRegisterCompilerFunction()
{
$this->smarty->registerPlugin(Smarty::PLUGIN_COMPILER, 'testcompilerfunction', 'mycompilerfunction');
$this->assertEquals('mycompilerfunction', $this->smarty->getRegisteredPlugin('compiler', 'testcompilerfunction')[0]);
$this->assertEquals('hello world 1', $this->smarty->fetch('eval:{testcompilerfunction var=1}'));
$this->assertEquals('hello world 1 2', $this->smarty->fetch('eval:{testcompilerfunction 1 var=2}'));
}

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testUnregisterCompilerFunctionOtherRegistered()

function mycompilerfunction($params, $smarty)
{
return "<?php echo 'hello world {$params['var']}';?>";
return "<?php echo 'hello world {$params[0]} {$params['var']}';?>";
}

function mycompilerfunctionopen($params, $smarty)
Expand Down

0 comments on commit ff12140

Please sign in to comment.