From 0e6e874011a6dd14dbc8a157d7f98e8980a3f149 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 10 Jul 2017 16:11:44 -0300
Subject: [PATCH] Bug 18851: Fix 3 other tests

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
---
 t/Patron.t                         | 12 ++++++++++--
 t/Search.t                         | 12 +++++++++++-
 t/SuggestionEngine_AuthorityFile.t | 10 ++++++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/t/Patron.t b/t/Patron.t
index be66f9d..2ddb3f7 100755
--- a/t/Patron.t
+++ b/t/Patron.t
@@ -17,16 +17,24 @@
 
 use Modern::Perl;
 
-use Test::More tests => 11;
+use Test::More;
 use Test::Warn;
 use t::lib::Mocks;
 
+use Module::Load::Conditional qw/check_install/;
+
 BEGIN {
-    use Test::DBIx::Class;
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 11;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
     use_ok('Koha::Object');
     use_ok('Koha::Patron');
 }
 
+use Test::DBIx::Class;
+
 my $object = Koha::Patron->new( { surname => 'Test Patron' } );
 is( $object->surname(), 'Test Patron', "Accessor returns correct value" );
 $object->surname('Test Patron Surname');
diff --git a/t/Search.t b/t/Search.t
index 5c35419..104e094 100755
--- a/t/Search.t
+++ b/t/Search.t
@@ -17,9 +17,19 @@
 
 use Modern::Perl;
 
-use Test::More tests => 3;
+use Test::More;
 use t::lib::Mocks;
 
+use Module::Load::Conditional qw/check_install/;
+
+BEGIN {
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 3;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+}
+
 # Mock the DB connexion and C4::Context
 use Test::DBIx::Class;
 
diff --git a/t/SuggestionEngine_AuthorityFile.t b/t/SuggestionEngine_AuthorityFile.t
index 96ca44d..f6ab479 100755
--- a/t/SuggestionEngine_AuthorityFile.t
+++ b/t/SuggestionEngine_AuthorityFile.t
@@ -28,6 +28,16 @@ use Test::More;
 use Test::MockModule;
 use t::lib::Mocks;
 
+use Module::Load::Conditional qw/check_install/;
+
+BEGIN {
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 46;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+}
+
 # Mock the DB connexion and C4::Context
 use Test::DBIx::Class;
 
-- 
2.1.4