Bug 35070: Add test verifying plugins cannot override core templates

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Julian Maurice 2023-12-18 08:36:12 +01:00 committed by Katrin Fischer
parent 21fd864416
commit 2233c230b2
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 22 additions and 4 deletions

View file

@ -16,7 +16,7 @@
use Modern::Perl;
use Test::More tests => 4;
use Test::More tests => 5;
use Test::MockModule;
use Test::Warn;
@ -51,7 +51,23 @@ subtest 'template_include_paths' => sub {
$template->process( \"[% INCLUDE test.inc %]", {}, \$output ) || die $template->error();
is( $output, 'included content' );
$schema->storage->txn_commit;
#Koha::Plugins::Methods->delete;
$schema->storage->txn_rollback;
};
subtest 'cannot override core templates' => sub {
plan tests => 1;
$schema->storage->txn_begin;
Koha::Plugins->new->InstallPlugins();
Koha::Plugin::Test->new->enable;
require C4::Templates;
my $c4_template = C4::Templates::gettemplate( 'intranet-main.tt', 'intranet' );
my $template = $c4_template->{TEMPLATE};
my $output = '';
$template->process( \"[% INCLUDE 'csrf-token.inc' %]", {}, \$output ) || die $template->error();
unlike( $output, qr/OVERRIDE/ );
$schema->storage->txn_rollback;
};

View file

@ -0,0 +1,2 @@
[%# This file has the same name as a core template. This is used to test that plugins cannot override core templates %]
[%~ 'OVERRIDE' ~%]