Bug 22466: Add tests
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 6 Mar 2019 14:59:35 +0000 (11:59 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 12 Mar 2019 08:35:28 +0000 (08:35 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit c7ef8e6b2db5830745759ad15fe9d6379f6f62b2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

t/template_filters.t

index fb30229..b479faa 100644 (file)
@@ -16,7 +16,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use Test::More tests => 6;
+use Test::More tests => 7;
 use t::lib::QA::TemplateFilters;
 
 subtest 'Asset must use raw' => sub {
@@ -301,5 +301,22 @@ EXPECTED
             }
         ]
     );
+};
 
+subtest 'Do not escape TT methods' => sub {
+    plan tests => 2;
+    my $input = <<INPUT;
+[% my_array.push(a_var) %]
+INPUT
+
+    my $expected = <<EXPECTED;
+[% my_array.push(a_var) %]
+EXPECTED
+
+    my $new_content = t::lib::QA::TemplateFilters::fix_filters($input);
+    is( $new_content . "\n", $expected, );
+
+
+    my @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input);
+    is_deeply(\@missing_filters, []);
 };