From 441ac8e100d3f35ae0f1031ed937c1bd456efe7e Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Fri, 19 Jun 2015 03:00:20 +0200 Subject: [PATCH] Add closure test --- tests/UnitTests/_Core/Filter/FilterTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/UnitTests/_Core/Filter/FilterTest.php b/tests/UnitTests/_Core/Filter/FilterTest.php index e65e9d1b..313c614c 100644 --- a/tests/UnitTests/_Core/Filter/FilterTest.php +++ b/tests/UnitTests/_Core/Filter/FilterTest.php @@ -94,6 +94,17 @@ class FilterTest extends PHPUnit_Smarty $this->assertEquals("bar hello world", $this->smarty->fetch($tpl)); } + /** + * test registered pre filter closure + */ + public function testRegisteredPreFilterClosure() + { + $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 */