mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Update tests
This commit is contained in:
14
tests/UnitTests/A_Core/Filter/FilterClosure.php
Normal file
14
tests/UnitTests/A_Core/Filter/FilterClosure.php
Normal 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));
|
||||||
|
|
@@ -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
|
||||||
*/
|
*/
|
||||||
|
@@ -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]";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user