Bug 12782: t/db_dependent/XISBN.t fails in DOM setup
authorTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 18 Aug 2014 19:42:39 +0000 (16:42 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 20 Aug 2014 15:29:19 +0000 (12:29 -0300)
To test:
- Have a DOM setup
- Run
  $ prove -v t/db_dependent/XISBN.t
=> FAIL: Can't call method "field" on an undefined value at .... C4/Search.pm ...
- Apply the patch
- Run
  $ prove -v t/db_dependent/XISBN.t
=> SUCCESS: Tests pass.
- Sign off

Regards
To+

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/XISBN.t

index 34f353a..1f6f797 100755 (executable)
@@ -10,6 +10,7 @@ use MARC::Record;
 use C4::Biblio;
 use C4::XISBN;
 use C4::Context;
+use C4::Search;
 use Test::MockModule;
 
 BEGIN {
@@ -113,6 +114,10 @@ sub Mock_SimpleSearch {
     }
     $record->append_fields($biblionumber_field);
 
-    push @results, $record->as_usmarc;
+    my $indexing_mode = C4::Context->config('zebra_bib_index_mode') // 'dom';
+    push @results, ( $indexing_mode eq 'dom' )
+                    ? $record->as_xml()
+                    : $record->as_usmarc() ;
+
     return ( undef, \@results, 1 );
 }