From 2fb81367a2c850aac1ca10d0fdf3274881a2d572 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 24 Jul 2017 12:44:30 -0300
Subject: [PATCH] Bug 18851: Make OverDrive.T pass if dbms is not running

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 t/Koha_ExternalContent_OverDrive.t | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/t/Koha_ExternalContent_OverDrive.t b/t/Koha_ExternalContent_OverDrive.t
index 5d2486f..f4cb775 100755
--- a/t/Koha_ExternalContent_OverDrive.t
+++ b/t/Koha_ExternalContent_OverDrive.t
@@ -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
-- 
2.7.4