Bugzilla – Attachment 16820 Details for
Bug 9907
Plugins test dies early on some servers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9907 - Plugins test dies early on some servers
Bug-9907---Plugins-test-dies-early-on-some-servers.patch (text/plain), 4.39 KB, created by
Kyle M Hall (khall)
on 2013-03-22 21:48:43 UTC
(
hide
)
Description:
Bug 9907 - Plugins test dies early on some servers
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-03-22 21:48:43 UTC
Size:
4.39 KB
patch
obsolete
>From 0386d68e2e050ccc35a905bb05823600384473da Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >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 | 27 ++++++++++++++++----------- > 3 files changed, 18 insertions(+), 13 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..1b87d2a 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,17 +41,22 @@ 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"); >-my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' ); >-unless ( $ae->extract( to => $plugins_dir ) ) { >- warn "ERROR: " . $ae->error; >+SKIP: { >+ skip "plugindir not set", 3 unless C4::Context->config("pluginsdir"); >+ >+ my $plugins_dir = C4::Context->config("pluginsdir"); >+ my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' ); >+ unless ( $ae->extract( to => $plugins_dir ) ) { >+ warn "ERROR: " . $ae->error; >+ } >+ use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink'); >+ $plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1}); >+ >+ ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); >+ Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" }); >+ ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." ); > } >-use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink'); >-$plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1}); > >-ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); >-Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" }); >-ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." ); >-- >1.7.2.5
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 9907
:
16819
| 16820