Bug 9907 - Plugins test dies early on some servers
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
parent
97e50e5424
commit
c09631917c
3 changed files with 19 additions and 14 deletions
|
@ -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) ) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink');
|
||||
$plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1});
|
||||
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." );
|
||||
}
|
||||
|
||||
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." );
|
||||
|
|
Loading…
Reference in a new issue