From 889fd2debf26af7750c95abba47c08748b8e208e Mon Sep 17 00:00:00 2001 From: uwetews Date: Sat, 27 May 2017 11:27:50 +0200 Subject: [PATCH] Update tests --- tests/UnitTests/A_Core/Filter/FilterClosure.php | 14 ++++++++++++++ tests/UnitTests/A_Core/Filter/FilterTest.php | 12 ++++-------- .../RegisterFunction/RegisterFunctionTest.php | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 tests/UnitTests/A_Core/Filter/FilterClosure.php 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]"; }