From 25df58a824fc3de961c1285bb4051c4e770b74eb Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 10 Aug 2017 13:02:23 +0200 Subject: [PATCH] Bug 19049: [Follow-up] Make sure that GetPlugins finds the plugin We have to mock_config the pluginsdir before Plugins is loaded, and we should pass an absolute path (not a relative one). If you did not install the test to_marc plugin, this test would fail. Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall Verified patch is compatible with original KitchenSink to_marc plugin --- t/db_dependent/ImportBatch.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/ImportBatch.t b/t/db_dependent/ImportBatch.t index 607c71e..9c62975 100644 --- a/t/db_dependent/ImportBatch.t +++ b/t/db_dependent/ImportBatch.t @@ -2,7 +2,7 @@ use Modern::Perl; use Test::More tests => 14; -use File::Basename; +use Cwd qw(abs_path); use File::Temp qw/tempfile/; use t::lib::Mocks; @@ -12,6 +12,10 @@ use Koha::Database; use Koha::Plugins; BEGIN { + # Mock pluginsdir before loading Plugins module + my $path = abs_path(__FILE__); + $path =~ s/(\/[^\/]+){2}$//; # remove db_dependent and filename + t::lib::Mocks::mock_config( 'pluginsdir', $path ); use_ok('C4::ImportBatch'); } @@ -182,7 +186,7 @@ subtest "RecordsFromMarcPlugin" => sub { 100,a = Another 245,a = Noise in the library|; close $fh; - t::lib::Mocks::mock_config( 'pluginsdir', dirname(__FILE__) . '/..' ); + my ( $plugin ) = Koha::Plugins->new->GetPlugins({ metadata => { name => 'MarcFieldValues' } }); isnt( $plugin, undef, "Plugin found" ); my $records = C4::ImportBatch::RecordsFromMarcPlugin( $name, ref $plugin, 'UTF-8' ); -- 2.10.2