From b47d6d5f47ed05f892ce15b0be6228713d46f0c7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Nov 2017 10:13:46 -0300 Subject: [PATCH] Bug 18712: Fix t/Matcher.t if DB is empty t/Matcher.t is failing with an empty DB, the data are not mocked correctly Test plan: drop your DB and recreate it without any data and prove t/Matcher.t --- t/Matcher.t | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/Matcher.t b/t/Matcher.t index 55b5a87cf4..3a5494e26e 100755 --- a/t/Matcher.t +++ b/t/Matcher.t @@ -33,10 +33,13 @@ BEGIN { } } -use_ok('C4::Matcher'); - use Test::DBIx::Class; +my $db = Test::MockModule->new('Koha::Database'); +$db->mock( _new_schema => sub { return Schema(); } ); + +use_ok('C4::Matcher'); + fixtures_ok [ MarcMatcher => [ [ 'matcher_id', 'code', 'description', 'record_type', 'threshold' ], @@ -45,9 +48,6 @@ fixtures_ok [ ], ], 'add fixtures'; -my $db = Test::MockModule->new('Koha::Database'); -$db->mock( _new_schema => sub { return Schema(); } ); - my @matchers = C4::Matcher::GetMatcherList(); is( $matchers[0]->{'matcher_id'}, 1, 'First matcher_id value is 1' ); -- 2.11.0