From 88b4cecd0cccbad365031c0823b3a993280fb716 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 20 Oct 2015 12:03:54 +0100 Subject: [PATCH] Bug 14778: Mocks Koha::Database->_new_schema instead of C4::Context->_new_dbh C4::Context::_new_dbh does not exist anymore. Koha::Database::_new_schema should be mocked instead. Will fix: - t/00-load.t - t/Breeding.t - t/ImportBatch.t - t/Message.t - t/Overdues.t - t/Prices.t - t/RotatingCollections.t - t/Search.t - t/SuggestionEngine_AuthorityFile.t - t/XSLT.t Signed-off-by: Martin Renvoize --- t/lib/Mocks.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/t/lib/Mocks.pm b/t/lib/Mocks.pm index 55ce9d5..22ac659 100644 --- a/t/lib/Mocks.pm +++ b/t/lib/Mocks.pm @@ -3,7 +3,7 @@ package t::lib::Mocks; use Modern::Perl; use C4::Context; -use DBD::Mock; +use Koha::Schema; use Test::MockModule; my %configs; @@ -39,10 +39,9 @@ sub mock_preference { } sub mock_dbh { - my $context = new Test::MockModule('C4::Context'); - $context->mock( '_new_dbh', sub { - my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) - || die "Cannot create handle: $DBI::errstr\n"; + our $context = new Test::MockModule('Koha::Database'); + $context->mock( '_new_schema', sub { + my $dbh = Koha::Schema->connect( 'DBI:Mock:', '', '' ); return $dbh; } ); return $context; -- 2.1.4