Bug 42136: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Jonathan Druart 2026-04-03 13:53:52 +02:00 committed by Jacob O'Mara
parent 40f6c95400
commit 63097f365a
No known key found for this signature in database
1 changed files with 23 additions and 1 deletions

View File

@ -18,7 +18,8 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Test::More tests => 3;
use Test::NoWarnings;
use Test::More tests => 4;
use utf8;
@ -58,3 +59,24 @@ subtest 'Plugin related tests' => sub {
"Processing template toolkit with a Koha plugin works"
);
};
subtest 'Security-related tests' => sub {
plan tests => 2;
is(
Koha::TemplateUtils::process_tt(
q{[% USE dir = Directory('/') ~%]
[% FOREACH entry IN dir.list ~%]
<p>[% entry.abs %]</p>
[% END %]},
),
q{},
"Plugins not allowed for User-entered TT"
);
is(
Koha::TemplateUtils::process_tt(q{[% USE raw %][% 'foo' | $raw %]}),
q{foo},
"Koha plugins are still available"
);
};