Bug 17600: Standardize our EXPORT_OK
[srvgit] / t / db_dependent / Koha / Z3950Responder / GenericSession.t
old mode 100644 (file)
new mode 100755 (executable)
index f888b02..74d0e9f
@@ -11,7 +11,7 @@ use File::Basename;
 use File::Copy;
 use FindBin qw($Bin);
 use XML::LibXML;
-use YAML;
+use YAML::XS;
 use ZOOM;
 
 BEGIN {
@@ -23,7 +23,7 @@ our $child;
 
 subtest 'test_search' => sub {
 
-    plan tests => 19;
+    plan tests => 20;
 
     t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch');
 
@@ -51,7 +51,7 @@ subtest 'test_search' => sub {
         MARC::Field->new('999', '', '', c => '1234567'),
     );
 
-    my $yaml = new Test::MockModule('YAML');
+    my $yaml = Test::MockModule->new('YAML::XS');
     $yaml->mock('LoadFile', sub {
         return {
             biblios => {
@@ -64,18 +64,18 @@ subtest 'test_search' => sub {
         };
     });
 
-    my $builder = new Test::MockModule('Koha::SearchEngine::Elasticsearch::QueryBuilder');
+    my $builder = Test::MockModule->new('Koha::SearchEngine::Elasticsearch::QueryBuilder');
     $builder->mock('build_query_compat', sub {
         my ( $self, $operators, $operands ) = @_;
 
         return (undef, $operands->[0]);
     });
 
-    my $search = new Test::MockModule('Koha::SearchEngine::Elasticsearch::Search');
+    my $search = Test::MockModule->new('Koha::SearchEngine::Elasticsearch::Search');
     $search->mock('simple_search_compat', sub {
         my ( $self, $query ) = @_;
 
-        return ('unexpected query', undef, 0) unless $query eq '((author:(author)) AND ((title:(title\(s\))) OR (title:(speciäl))))';
+        return ('unexpected query', undef, 0) unless $query eq '((author:(author)) AND ((title:(title\(s\))) OR (title:(speciäl))))' || $query eq "(simple search)";
 
         my @records = ($marc_record_1, $marc_record_2);
         return (undef, \@records, 2);
@@ -93,7 +93,7 @@ subtest 'test_search' => sub {
     sleep(10); # Just a try to see if it fixes Jenkins
 
     # Z39.50 protocol tests
-    my $o = new ZOOM::Options();
+    my $o = ZOOM::Options->new();
     $o->option(preferredRecordSyntax => 'xml');
     $o->option(elementSetName => 'marcxml');
     $o->option(databaseName => 'biblios');
@@ -117,6 +117,9 @@ subtest 'test_search' => sub {
     ok($returned2, 'Record 2 returned as MARCXML');
     is($returned2->as_xml, $marc_record_2->as_xml, 'Record 2 returned properly');
 
+    $rs = $Zconn->search_pqf('"simple search"');
+    is($Zconn->errcode(), 0, 'Search is successful: ' . $Zconn->errmsg());
+
     # SRU protocol tests
     my $base = 'http://localhost:42111';
     my $ns = 'http://www.loc.gov/zing/srw/';