diff --git a/tests/UnitTests/A_Core/Filter/FilterClosure.php b/tests/UnitTests/A_Core/Filter/FilterClosure.php new file mode 100644 index 00000000..2b642640 --- /dev/null +++ b/tests/UnitTests/A_Core/Filter/FilterClosure.php @@ -0,0 +1,14 @@ +smarty->registerFilter(Smarty::FILTER_PRE, function ($input) { + return '{$foo}' . $input; + }); + $tpl = $this->smarty->createTemplate('eval:{" hello world"}'); + $tpl->assign('foo', 'buh'); + $this->assertEquals("buh hello world", $this->smarty->fetch($tpl)); + diff --git a/tests/UnitTests/A_Core/Filter/FilterTest.php b/tests/UnitTests/A_Core/Filter/FilterTest.php index 00563c47..e3847be1 100644 --- a/tests/UnitTests/A_Core/Filter/FilterTest.php +++ b/tests/UnitTests/A_Core/Filter/FilterTest.php @@ -189,21 +189,17 @@ class FilterTest extends PHPUnit_Smarty * test registered pre filter closure * @requires PHP 5.3 */ - /** + public function testRegisteredPreFilterClosure() { if (version_compare(PHP_VERSION,'5.3','<')) { $this->markTestSkipped('does not run for PHP 5.2'); + } else { + include 'FilterClosure.php'; } - $this->smarty->registerFilter(Smarty::FILTER_PRE, function ($input) { - return '{$foo}' . $input; - }); - $tpl = $this->smarty->createTemplate('eval:{" hello world"}'); - $tpl->assign('foo', 'buh'); - $this->assertEquals("buh hello world", $this->smarty->fetch($tpl)); } -*/ + /** * test registered pre filter class */ diff --git a/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php b/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php index 01fabf3e..8cc828cc 100644 --- a/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php +++ b/tests/UnitTests/SmartyMethodsTests/RegisterFunction/RegisterFunctionTest.php @@ -155,14 +155,14 @@ class RegisterFunctionTest extends PHPUnit_Smarty } } -function myfunction($params, &$smarty) +function myfunction($params, $smarty) { return "hello world $params[value]"; } class myfunctionclass { - static function execute($params, &$smarty) + static function execute($params, $smarty) { return "hello world $params[value]"; }