From 63a48597c449e6de72a044d4483b8e52641ab721 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 15 Dec 2023 16:58:00 -0300 Subject: [PATCH] Bug 35070: Tidy Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer (cherry picked from commit 21fd8644163a171374f6f1a361b452c72eb69b26) Signed-off-by: Fridolin Somers (cherry picked from commit cd2e54f6e198ec72292fb7a67b1b1c38650e5513) Signed-off-by: Lucas Gass --- C4/Templates.pm | 6 ++++-- .../Koha/Plugins/TemplateIncludePathHook.t | 16 ++++++++-------- t/lib/plugins/Koha/Plugin/Test/inc/test.inc | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) mode change 100644 => 100755 t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t diff --git a/C4/Templates.pm b/C4/Templates.pm index ea10a6bd20..fb7d3e5cb5 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -62,8 +62,10 @@ sub new { push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en'; } - my @plugins_include_paths = Koha::Plugins->call( 'template_include_paths', - { interface => $interface, lang => $lang } ); + my @plugins_include_paths = Koha::Plugins->call( + 'template_include_paths', + { interface => $interface, lang => $lang } + ); push @includes, map { $_ ? @$_ : () } @plugins_include_paths; # Do not use template cache if script is called from commandline diff --git a/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t b/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t old mode 100644 new mode 100755 index 674127504c..0c260c4bd7 --- a/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t +++ b/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t @@ -22,20 +22,19 @@ use Test::Warn; use File::Basename; - BEGIN { # Mock pluginsdir before loading Plugins module my $path = dirname(__FILE__) . '/../../../lib/plugins'; require t::lib::Mocks; t::lib::Mocks::mock_config( 'enable_plugins', 1 ); - t::lib::Mocks::mock_config( 'pluginsdir', $path ); + t::lib::Mocks::mock_config( 'pluginsdir', $path ); use_ok('Koha::Plugins'); use_ok('Koha::Plugins::Handler'); use_ok('Koha::Plugin::Test'); } -my $schema = Koha::Database->new->schema; +my $schema = Koha::Database->new->schema; subtest 'template_include_paths' => sub { plan tests => 1; @@ -46,12 +45,13 @@ subtest 'template_include_paths' => sub { 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 test.inc %]", {}, \$output) || die $template->error(); - is($output, 'included content'); + my $c4_template = C4::Templates::gettemplate( 'intranet-main.tt', 'intranet' ); + my $template = $c4_template->{TEMPLATE}; + my $output = ''; + $template->process( \"[% INCLUDE test.inc %]", {}, \$output ) || die $template->error(); + is( $output, 'included content' ); $schema->storage->txn_commit; + #Koha::Plugins::Methods->delete; }; diff --git a/t/lib/plugins/Koha/Plugin/Test/inc/test.inc b/t/lib/plugins/Koha/Plugin/Test/inc/test.inc index e6edb86a3c..49c5690fcb 100644 --- a/t/lib/plugins/Koha/Plugin/Test/inc/test.inc +++ b/t/lib/plugins/Koha/Plugin/Test/inc/test.inc @@ -1 +1 @@ -[% 'included content' ~%] +[% 'included content' | html ~%] -- 2.39.5