Bug 35070: Tidy

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 21fd864416)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomas Cohen Arazi 2023-12-15 16:58:00 -03:00 committed by Fridolin Somers
parent fe5b461cbf
commit cd2e54f6e1
3 changed files with 13 additions and 11 deletions

View File

@ -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

16
t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t Normal file → Executable file
View File

@ -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;
};

View File

@ -1 +1 @@
[% 'included content' ~%]
[% 'included content' | html ~%]