From f4eacd15c1b5cb28862044a776d215693f479f0b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 22 Mar 2013 14:31:15 -0700 Subject: [PATCH] Bug 9907 - Plugins test dies early on some servers --- Koha/Plugins.pm | 2 +- Koha/Plugins/Handler.pm | 2 +- t/db_dependent/Plugins.t | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index 1360afa..3b31fc5 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -63,7 +63,7 @@ sub GetPlugins { foreach my $plugin_class (@plugin_classes) { if ( can_load( modules => { $plugin_class => undef } ) ) { - my $plugin = $plugin_class->new(); + my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); if ($method) { if ( $plugin->can($method) ) { diff --git a/Koha/Plugins/Handler.pm b/Koha/Plugins/Handler.pm index 18ceba1..41c242b 100644 --- a/Koha/Plugins/Handler.pm +++ b/Koha/Plugins/Handler.pm @@ -58,7 +58,7 @@ sub run { my $cgi = $args->{'cgi'}; if ( can_load( modules => { $plugin_class => undef } ) ) { - my $plugin = $plugin_class->new( { cgi => $cgi } ); + my $plugin = $plugin_class->new( { cgi => $cgi, enable_plugins => $args->{'enable_plugins'} } ); if ( $plugin->can($plugin_method) ) { return $plugin->$plugin_method(); } else { diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Plugins.t index 03fa4bf..4c5282d 100755 --- a/t/db_dependent/Plugins.t +++ b/t/db_dependent/Plugins.t @@ -33,7 +33,7 @@ ok( $plugin->can('configure'), 'Test plugin can configure' ); ok( $plugin->can('install'), 'Test plugin can install' ); ok( $plugin->can('uninstall'), 'Test plugin can install' ); -ok( Koha::Plugins::Handler->run({ class => "Koha::Plugin::Test", method => 'report' }) eq "Koha::Plugin::Test::report", 'Test run plugin report method' ); +ok( Koha::Plugins::Handler->run({ class => "Koha::Plugin::Test", method => 'report', enable_plugins => 1 }) eq "Koha::Plugin::Test::report", 'Test run plugin report method' ); my $metadata = $plugin->get_metadata(); ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); @@ -41,7 +41,7 @@ ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' ); ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); -my @plugins = Koha::Plugins->new()->GetPlugins( 'report' ); +my @plugins = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins( 'report' ); ok( $plugins[0]->get_metadata()->{'name'} eq 'Test Plugin', "Koha::Plugins::GetPlugins functions correctly" ); my $plugins_dir = C4::Context->config("pluginsdir"); -- 1.7.2.5