From c83e64941cda7c625451936aea712bdd5714ba6e 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 --- 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 ea10a6bd20e..fb7d3e5cb56 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 674127504c3..0c260c4bd77 --- 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 e6edb86a3c2..49c5690fcb4 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.43.0