Skip to content

Commit 886d3f2

Browse files
committed
test: add test for filters
1 parent 454be20 commit 886d3f2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/CI4Twig/TwigTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,18 @@ public function testFunctionSafe()
110110
$output = $obj->render('functions_safe');
111111
$this->assertSame("<s>test</s>\n", $output);
112112
}
113+
114+
public function testFilter()
115+
{
116+
$obj = new Twig(
117+
[
118+
'paths' => __DIR__ . '/../templates/',
119+
'filters' => ['str_rot13'],
120+
'cache' => false,
121+
]
122+
);
123+
124+
$output = $obj->render('filters');
125+
$this->assertSame("PbqrVtavgre Fvzcyr naq Frpher Gjvt\n", $output);
126+
}
113127
}

tests/templates/filters.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ 'CodeIgniter Simple and Secure Twig'|str_rot13 }}

0 commit comments

Comments
 (0)