Bug 18851: Make OverDrive.T pass if dbms is not running
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Jul 2017 15:44:30 +0000 (12:44 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 8 Aug 2017 12:21:06 +0000 (09:21 -0300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/Koha_ExternalContent_OverDrive.t

index 5d2486f..f4cb775 100755 (executable)
@@ -1,9 +1,27 @@
+#!/usr/bin/env perl
+
 use Modern::Perl;
 
 use t::lib::Mocks;
-use Test::More tests => 5;                      # last test to print
+use Test::More;
+use Test::MockModule;
+
+use Module::Load::Conditional qw( can_load check_install );
+
+use Koha::Schema;
+
+BEGIN {
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 5;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+}
+
+use Test::DBIx::Class;
 
-use Module::Load::Conditional qw( can_load );
+my $db = Test::MockModule->new('Koha::Database');
+$db->mock( _new_schema => sub { return Schema(); } );
 
 SKIP: {
     skip "cannot find WebService::ILS::OverDrive::Patron", 5