From d25f3e84374ec8d7c85f8ed805102f67c0a73d77 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 12 Jul 2019 11:45:25 +0100 Subject: [PATCH] Bug 22709: (RM follow-up) Clean up plugin tests The plugin tests were failing due to failed rollbacks and run order. This patch moves them into their own directory and adds a reset test to restore the original state of the plugin system after the tests have run. Signed-off-by: Martin Renvoize --- .../Plugins/Biblio_and_Items_plugin_hooks.t | 2 +- .../{ => Koha/Plugins}/KitchenSinkPlugin.kpz | Bin t/db_dependent/{ => Koha/Plugins}/Plugins.t | 6 +++- t/db_dependent/Koha/Plugins/z_reset.t | 28 ++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) rename t/db_dependent/{ => Koha}/Plugins/Biblio_and_Items_plugin_hooks.t (98%) rename t/db_dependent/{ => Koha/Plugins}/KitchenSinkPlugin.kpz (100%) rename t/db_dependent/{ => Koha/Plugins}/Plugins.t (98%) create mode 100644 t/db_dependent/Koha/Plugins/z_reset.t diff --git a/t/db_dependent/Plugins/Biblio_and_Items_plugin_hooks.t b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t similarity index 98% rename from t/db_dependent/Plugins/Biblio_and_Items_plugin_hooks.t rename to t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t index a841e2c170..3a89ba1330 100755 --- a/t/db_dependent/Plugins/Biblio_and_Items_plugin_hooks.t +++ b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t @@ -28,7 +28,7 @@ use t::lib::TestBuilder; BEGIN { # Mock pluginsdir before loading Plugins module - my $path = dirname(__FILE__) . '/../../lib'; + my $path = dirname(__FILE__) . '/../../../lib'; t::lib::Mocks::mock_config( 'pluginsdir', $path ); use_ok('Koha::Plugins'); diff --git a/t/db_dependent/KitchenSinkPlugin.kpz b/t/db_dependent/Koha/Plugins/KitchenSinkPlugin.kpz similarity index 100% rename from t/db_dependent/KitchenSinkPlugin.kpz rename to t/db_dependent/Koha/Plugins/KitchenSinkPlugin.kpz diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Koha/Plugins/Plugins.t similarity index 98% rename from t/db_dependent/Plugins.t rename to t/db_dependent/Koha/Plugins/Plugins.t index 052b7eaa29..178c5447f0 100755 --- a/t/db_dependent/Plugins.t +++ b/t/db_dependent/Koha/Plugins/Plugins.t @@ -35,7 +35,7 @@ use t::lib::Mocks; BEGIN { # Mock pluginsdir before loading Plugins module - my $path = dirname(__FILE__) . '/../lib'; + my $path = dirname(__FILE__) . '/../../../lib'; t::lib::Mocks::mock_config( 'pluginsdir', $path ); use_ok('Koha::Plugins'); @@ -297,6 +297,10 @@ subtest 'bundle_path() tests' => sub { my @current_dir = File::Spec->splitdir(abs_path(__FILE__)); # remote Plugins.t pop @current_dir; + # remove /Plugins + pop @current_dir; + # remove /Koha + pop @current_dir; # remove db_dependent pop @current_dir; diff --git a/t/db_dependent/Koha/Plugins/z_reset.t b/t/db_dependent/Koha/Plugins/z_reset.t new file mode 100644 index 0000000000..302873a317 --- /dev/null +++ b/t/db_dependent/Koha/Plugins/z_reset.t @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, see . + +use Modern::Perl; +use C4::Context; +use Koha::Plugins; +use Koha::Plugins::Methods; + +use Test::More tests => 1; + +my $plugins = Koha::Plugins->new()->InstallPlugins; + +ok( 1, 'Plugins reset' ); + +1; -- 2.20.1