Bug 13276: use t::lib::Mocks::mock_dbh
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 18 Nov 2014 09:56:52 +0000 (10:56 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 19 Nov 2014 14:30:45 +0000 (11:30 -0300)
To use this patch, patch from bug 13274 should be applied too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/XSLT.t

index 347d372..21c2e93 100755 (executable)
--- a/t/XSLT.t
+++ b/t/XSLT.t
@@ -20,18 +20,13 @@ use Modern::Perl;
 use Test::More tests => 8;
 use File::Temp;
 use File::Path qw/make_path/;
-use Test::MockModule;
-use DBD::Mock;
 
-# Mock the DB connexion and C4::Context
-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";
-        return $dbh;
-});
+use t::lib::Mocks;
 
-use_ok('C4::XSLT');
+BEGIN {
+    my $context_module = t::lib::Mocks::mock_dbh;
+    use_ok('C4::XSLT');
+};
 
 my $dir = File::Temp->newdir();
 my @themes = ('prog', 'test');