From 160230931245853e6b16383baea22df9266cea48 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Oct 2015 11:40:43 +0100 Subject: [PATCH] Bug 14778: [DO NOT WORK] Try to make DBI:Mock pass but fail I need some help here, I don't understand what's happen. Some other tests are failing because they mock the db handler. Let's try with this easy one. --- t/db_dependent/Sitemapper.t | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Sitemapper.t b/t/db_dependent/Sitemapper.t index 293edad..3eb5b92 100755 --- a/t/db_dependent/Sitemapper.t +++ b/t/db_dependent/Sitemapper.t @@ -23,6 +23,7 @@ use File::Basename; use File::Path; use DateTime; use Test::More tests => 14; +use Koha::Schema; BEGIN { @@ -43,12 +44,13 @@ sub slurp { # Create 3 mocked dataset to be used by Koha::Sitemaper in place of DB content my $module_context = new Test::MockModule('C4::Context'); -$module_context->mock('_new_dbh', sub { - my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) - || die "Cannot create handle: $DBI::errstr\n"; +$module_context->mock('dbh', sub { + my $schema = Koha::Schema->connect( 'dbi:Mock:', '', '' ); + my $dbh = $schema->storage->dbh + || die "Cannot create handle\n"; return $dbh }); -my $dbh = C4::Context->dbh(); +my $dbh = C4::Context->dbh; my $two_bibs = [ [ qw/ biblionumber timestamp / ], [ qw/ 1234 2013-11-15 / ], -- 2.1.0