Add STRIP option

This commit is contained in:
bzick
2014-05-08 12:56:37 +04:00
parent 83e02ebbe9
commit 45afbfabdf
12 changed files with 209 additions and 87 deletions

View File

@@ -185,7 +185,7 @@ class TemplateTest extends TestCase
'Mod: {$lorem|str_rot13}!',
'Fenom\Error\CompileException',
"Modifier str_rot13 not found",
Fenom::DENY_INLINE_FUNCS
Fenom::DENY_NATIVE_FUNCS
),
array('Mod: {$lorem|my_encode}!', 'Fenom\Error\CompileException', "Modifier my_encode not found"),
array('Mod: {$lorem|truncate:}!', 'Fenom\Error\CompileException', "Unexpected end of expression"),

View File

@@ -13,7 +13,8 @@ class FenomTest extends \Fenom\TestCase
array("auto_reload", Fenom::AUTO_RELOAD),
array("force_include", Fenom::FORCE_INCLUDE),
array("auto_escape", Fenom::AUTO_ESCAPE),
array("force_verify", Fenom::FORCE_VERIFY)
array("force_verify", Fenom::FORCE_VERIFY),
array("strip", Fenom::AUTO_STRIP),
);
}
@@ -289,6 +290,19 @@ class FenomTest extends \Fenom\TestCase
);
$this->assertSame(3, $iteration);
}
/**
* @group strip
*/
public function testStrip() {
$this->fenom->setOptions(Fenom::AUTO_STRIP);
$tpl = <<<TPL
<div class="item item-one">
<a href="/item/{\$one}">number {\$num.1}</a>
</div>
TPL;
$this->assertRender($tpl, '<div class="item item-one"><a href="/item/1">number one</a></div>');
}
}