diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t index 01bcc0f97d..55f25a189d 100755 --- a/t/db_dependent/XISBN.t +++ b/t/db_dependent/XISBN.t @@ -5,21 +5,24 @@ use Modern::Perl; -# use Test::Class::Load qw ( t/db_dependent/ ); use Test::More tests => 5; use MARC::Record; use C4::Biblio; use C4::XISBN; -use Data::Dumper; use C4::Context; +use Test::MockModule; BEGIN { use_ok('C4::XISBN'); } -# Avoid "redefined subroutine" warnings -local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /redefined/ }; -*C4::Search::SimpleSearch = \&Mock_SimpleSearch; +my $dbh = C4::Context->dbh; +$dbh->{RaiseError} = 1; +$dbh->{AutoCommit} = 0; + +my $search_module = new Test::MockModule('C4::Search'); + +$search_module->mock('SimpleSearch', \&Mock_SimpleSearch ); my $context = C4::Context->new; @@ -62,11 +65,6 @@ is( $results_xisbn->[0]->{biblionumber}, $biblionumber3, "Gets correct biblionumber from a book with a similar isbn using XISBN." ); -# clean up after ourselves -DelBiblio($biblionumber1); -DelBiblio($biblionumber2); -DelBiblio($biblionumber3); - # Util subs # Add new biblio with isbn and return biblionumber