Bugzilla – Attachment 160378 Details for
Bug 35070
Koha plugins implementing "background_jobs" hook can't provide view template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35070: Add test verifying plugins cannot override core templates
Bug-35070-Add-test-verifying-plugins-cannot-overri.patch (text/plain), 2.21 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-12-29 19:14:43 UTC
(
hide
)
Description:
Bug 35070: Add test verifying plugins cannot override core templates
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-12-29 19:14:43 UTC
Size:
2.21 KB
patch
obsolete
>From f8fac43d31cce61fe41fa56fd1c3871ac3cf9f1c Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 18 Dec 2023 08:36:12 +0100 >Subject: [PATCH] Bug 35070: Add test verifying plugins cannot override core > templates > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../Koha/Plugins/TemplateIncludePathHook.t | 22 ++++++++++++++++--- > .../Koha/Plugin/Test/inc/csrf-token.inc | 2 ++ > 2 files changed, 21 insertions(+), 3 deletions(-) > create mode 100644 t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc > >diff --git a/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t b/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t >index 0c260c4bd77..9ac1540967f 100755 >--- a/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t >+++ b/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t >@@ -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; >+ $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/ ); > >- #Koha::Plugins::Methods->delete; >+ $schema->storage->txn_rollback; > }; >diff --git a/t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc b/t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc >new file mode 100644 >index 00000000000..a48f8faa070 >--- /dev/null >+++ b/t/lib/plugins/Koha/Plugin/Test/inc/csrf-token.inc >@@ -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' ~%] >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35070
:
157323
|
159205
|
159248
|
159901
|
159902
|
159938
| 160378 |
160565