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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Verified patch is compatible with original KitchenSink to_marc plugin
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0987b135ea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
c6e3f2ac05
commit
3bbb89c571
|
|
@ -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' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue