Bug 10698: (follow-up) remove now-superfluous FIXME comment
[koha_fer] / t / db_dependent / Plugins.t
index 03fa4bf..bb7a836 100755 (executable)
@@ -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,24 @@ 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: {
+    my $plugins_dir = C4::Context->config("pluginsdir");
+    skip "plugindir not set", 3 unless defined $plugins_dir;
+    skip "plugindir not writable", 3 unless -w $plugins_dir;
+    skip "KitchenSink plugin already installed", 3 if (-f "$plugins_dir/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm");
+
+    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." );