X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2Ftemplate_filters.t;h=fb30229eefea11f9b74284c8bbf8959a0810e54b;hb=0718416ff1ca70a25bc12fa3b677fdeafd7854c8;hp=be638e1c3c43e7157371b8bd94eb71f807155b14;hpb=f9e83266d1e4c987412a57a77ca7d0a4d653a65b;p=koha.git diff --git a/t/template_filters.t b/t/template_filters.t index be638e1c3c..fb30229eef 100644 --- a/t/template_filters.t +++ b/t/template_filters.t @@ -16,7 +16,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 5; +use Test::More tests => 6; use t::lib::QA::TemplateFilters; subtest 'Asset must use raw' => sub { @@ -260,3 +260,46 @@ INPUT @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input); is_deeply( \@missing_filters, [], 'html_entity is a valid filter for href' ); }; + +subtest 'Do not escape KohaDates|Prices|HtmlTags output' => sub { + plan tests => 2; + my $input = < 1 %] +[% var | \$KohaDates | html %] +[% var | \$KohaDates with_hours => 1 | html %] +[% var | \$Price %] +[% var | \$HtmlTags %] +INPUT + + my $expected = < 1 %] +[% var | \$KohaDates %] +[% var | \$KohaDates with_hours => 1 %] +[% var | \$Price %] +[% var | \$HtmlTags %] +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, + [ + { + error => "extra_filter_not_needed", + line => "[% var | \$KohaDates | html %]", + line_number => 3, + }, + { + error => "extra_filter_not_needed", + line => "[% var | \$KohaDates with_hours => 1 | html %]", + line_number => 4, + } + ] + ); + +};