Lines 1-6
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
|
|
4 |
use utf8; |
4 |
|
5 |
|
5 |
use Test::More tests => 3; |
6 |
use Test::More tests => 3; |
6 |
use Test::WWW::Mechanize; |
7 |
use Test::WWW::Mechanize; |
Lines 74-80
subtest 'test_search' => sub {
Link Here
|
74 |
$search->mock('simple_search_compat', sub { |
75 |
$search->mock('simple_search_compat', sub { |
75 |
my ( $self, $query ) = @_; |
76 |
my ( $self, $query ) = @_; |
76 |
|
77 |
|
77 |
return ('unexpected query', undef, 0) unless $query eq '((author:(author)) AND ((title:(title\(s\))) OR (title:(another))))'; |
78 |
return ('unexpected query', undef, 0) unless $query eq '((author:(author)) AND ((title:(title\(s\))) OR (title:(speciäl))))'; |
78 |
|
79 |
|
79 |
my @records = ($marc_record_1, $marc_record_2); |
80 |
my @records = ($marc_record_1, $marc_record_2); |
80 |
return (undef, \@records, 2); |
81 |
return (undef, \@records, 2); |
Lines 103-109
subtest 'test_search' => sub {
Link Here
|
103 |
$Zconn->connect('localhost:42111', 0); |
104 |
$Zconn->connect('localhost:42111', 0); |
104 |
is($Zconn->errcode(), 0, 'Connection is successful: ' . $Zconn->errmsg()); |
105 |
is($Zconn->errcode(), 0, 'Connection is successful: ' . $Zconn->errmsg()); |
105 |
|
106 |
|
106 |
my $rs = $Zconn->search_pqf('@and @attr 1=1 @attr 4=1 author @or @attr 1=4 title(s) @attr 1=4 another'); |
107 |
my $rs = $Zconn->search_pqf('@and @attr 1=1 @attr 4=1 author @or @attr 1=4 title(s) @attr 1=4 speciäl'); |
107 |
is($Zconn->errcode(), 0, 'Search is successful: ' . $Zconn->errmsg()); |
108 |
is($Zconn->errcode(), 0, 'Search is successful: ' . $Zconn->errmsg()); |
108 |
|
109 |
|
109 |
is($rs->size(), 2, 'Two results returned'); |
110 |
is($rs->size(), 2, 'Two results returned'); |
Lines 132-138
subtest 'test_search' => sub {
Link Here
|
132 |
@nodes = $dom->getElementsByTagNameNS($ns, 'diagnostics'); |
133 |
@nodes = $dom->getElementsByTagNameNS($ns, 'diagnostics'); |
133 |
is(scalar(@nodes), 1, 'diagnostics returned for bad query'); |
134 |
is(scalar(@nodes), 1, 'diagnostics returned for bad query'); |
134 |
|
135 |
|
135 |
$agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&version=1.1&maximumRecords=10&query=(dc.author%3dauthor AND (dc.title%3d\"title(s)\" OR dc.title%3danother))", 'Retrieve search results'); |
136 |
$agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&version=1.1&maximumRecords=10&query=(dc.author%3dauthor AND (dc.title%3d\"title(s)\" OR dc.title%3dspeciäl))", 'Retrieve search results'); |
136 |
$dom = XML::LibXML->load_xml(string => $agent->content()); |
137 |
$dom = XML::LibXML->load_xml(string => $agent->content()); |
137 |
@nodes = $dom->getElementsByTagNameNS($ns, 'searchRetrieveResponse'); |
138 |
@nodes = $dom->getElementsByTagNameNS($ns, 'searchRetrieveResponse'); |
138 |
is(scalar(@nodes), 1, 'searchRetrieveResponse returned'); |
139 |
is(scalar(@nodes), 1, 'searchRetrieveResponse returned'); |
139 |
- |
|
|