Update tests

This commit is contained in:
uwetews
2017-05-27 11:27:50 +02:00
parent 52f84dc39d
commit 889fd2debf
3 changed files with 20 additions and 10 deletions

View File

@@ -0,0 +1,14 @@
<?php
/**
* test registered pre filter closure
* @requires PHP 5.3
*/
$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));

View File

@@ -189,21 +189,17 @@ class FilterTest extends PHPUnit_Smarty
* test registered pre filter closure * test registered pre filter closure
* @requires PHP 5.3 * @requires PHP 5.3
*/ */
/**
public function testRegisteredPreFilterClosure() public function testRegisteredPreFilterClosure()
{ {
if (version_compare(PHP_VERSION,'5.3','<')) if (version_compare(PHP_VERSION,'5.3','<'))
{ {
$this->markTestSkipped('does not run for PHP 5.2'); $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 * test registered pre filter class
*/ */

View File

@@ -155,14 +155,14 @@ class RegisterFunctionTest extends PHPUnit_Smarty
} }
} }
function myfunction($params, &$smarty) function myfunction($params, $smarty)
{ {
return "hello world $params[value]"; return "hello world $params[value]";
} }
class myfunctionclass class myfunctionclass
{ {
static function execute($params, &$smarty) static function execute($params, $smarty)
{ {
return "hello world $params[value]"; return "hello world $params[value]";
} }