Bug 17006: Unit tests
[koha.git] / t / db_dependent / XISBN.t
index c1b0f1d..803743a 100755 (executable)
@@ -11,6 +11,7 @@ use C4::Biblio;
 use C4::XISBN;
 use C4::Context;
 use C4::Search;
+use Koha::Database;
 use t::lib::Mocks;
 use Test::MockModule;
 
@@ -18,9 +19,8 @@ BEGIN {
     use_ok('C4::XISBN');
 }
 
-my $dbh = C4::Context->dbh;
-$dbh->{RaiseError} = 1;
-$dbh->{AutoCommit} = 0;
+my $schema = Koha::Database->new->schema;
+$schema->storage->txn_begin;
 
 my $search_module = new Test::MockModule('C4::Search');
 
@@ -62,8 +62,6 @@ SKIP: {
         "Gets correct biblionumber from a book with a similar isbn using ThingISBN." );
 }
 
-$dbh->rollback;
-
 # Util subs
 
 # Add new biblio with isbn and return biblionumber
@@ -109,10 +107,7 @@ sub Mock_SimpleSearch {
     }
     $record->append_fields($biblionumber_field);
 
-    my $indexing_mode = C4::Context->config('zebra_bib_index_mode') // 'dom';
-    push @results, ( $indexing_mode eq 'dom' )
-                    ? $record->as_xml()
-                    : $record->as_usmarc() ;
+    push @results, $record->as_xml();
 
     return ( undef, \@results, 1 );
 }