From eeb4434ce6671bf7155a0b6f9069e11b08316c0e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 21 Apr 2022 17:45:14 +0200 Subject: [PATCH] Bug 22223: Add tests --- t/Koha_Template_Plugin_Filter.t | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 t/Koha_Template_Plugin_Filter.t diff --git a/t/Koha_Template_Plugin_Filter.t b/t/Koha_Template_Plugin_Filter.t new file mode 100755 index 00000000000..26358d63e73 --- /dev/null +++ b/t/Koha_Template_Plugin_Filter.t @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use Test::More tests => 3; +use Template; + +my $template = Template->new({ + PLUGIN_BASE => 'Koha::Template::Plugin', +}); + +my $tt = < $uri }; +$template->process(\$tt, $vars, \$output); +is($output, $uri); + +$output = ''; +$vars = { uri => $encoded_uri }; +$template->process(\$tt, $vars, \$output); +# uri filter would have generated https://www.foo.com/url?q=https%253A%252F%252Fbar.org +is($output, $encoded_uri, 'URI is not double encoded'); -- 2.25.1