@@ -, +, @@ koha_plugin_com_bywatersolutions_kitchensink_mytable not always dropped after running Plugin.t still exists. (It should have been deleted.) Remove it manually. --- Koha/Plugins/Handler.pm | 9 ++++++++- t/db_dependent/Plugins.t | 5 ++--- 2 files changed, 10 insertions(+), 4 deletions(-) --- a/Koha/Plugins/Handler.pm +++ a/Koha/Plugins/Handler.pm @@ -78,11 +78,18 @@ Deletes a plugin sub delete { my ( $class, $args ) = @_; + + return unless ( C4::Context->config("enable_plugins") || $args->{'enable_plugins'} ); + my $plugin_class = $args->{'class'}; my $plugin_dir = C4::Context->config("pluginsdir"); my $plugin_path = "$plugin_dir/" . join( '/', split( '::', $args->{'class'} ) ); - Koha::Plugins::Handler->run( { class => $plugin_class, method => 'uninstall' } ); + Koha::Plugins::Handler->run({ + class => $plugin_class, + method => 'uninstall', + enable_plugins => $args->{enable_plugins}, + }); C4::Context->dbh->do( "DELETE FROM plugin_data WHERE plugin_class = ?", undef, ($plugin_class) ); --- a/t/db_dependent/Plugins.t +++ a/t/db_dependent/Plugins.t @@ -49,7 +49,7 @@ 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"); + # no need to skip further tests if KitchenSink would already exist my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' ); unless ( $ae->extract( to => $plugins_dir ) ) { @@ -59,7 +59,6 @@ SKIP: { $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" }); + Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink", enable_plugins => 1 }); ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." ); } - --