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 35cf33a18e
commit 706fe8aa07
No known key found for this signature in database
1 changed files with 22 additions and 1 deletions

View File

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::NoWarnings;
use Test::More tests => 4;
use Test::More tests => 5;
use utf8;
@ -59,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"
);
};