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:
parent
21fd864416
commit
2233c230b2
2 changed files with 22 additions and 4 deletions
|
@ -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;
|
||||
};
|
||||
|
|
2
t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc
Normal file
2
t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc
Normal 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' ~%]
|
Loading…
Reference in a new issue