Lines 4-10
Link Here
|
4 |
|
4 |
|
5 |
use Modern::Perl; |
5 |
use Modern::Perl; |
6 |
|
6 |
|
7 |
use Test::More tests => 1; |
7 |
use Test::More tests => 2; |
8 |
|
8 |
|
9 |
use MARC::Field; |
9 |
use MARC::Field; |
10 |
use MARC::Record; |
10 |
use MARC::Record; |
Lines 44-49
subtest 'Test extract_biblionumber' => sub {
Link Here
|
44 |
is( $bibno, 4567, 'Extracted biblio number for Zebra' ); |
44 |
is( $bibno, 4567, 'Extracted biblio number for Zebra' ); |
45 |
}; |
45 |
}; |
46 |
|
46 |
|
|
|
47 |
subtest 'Test escape_query' => sub { |
48 |
plan tests => 2; |
49 |
|
50 |
my @engines = ('Zebra','Elasticsearch'); |
51 |
my $expected = { |
52 |
Zebra => q{+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /}, |
53 |
Elasticsearch => q{\\+ \\- \\= \\&& \\|| \\! \\( \\) \\{ \\} \\[ \\] \\^ \\" \\~ \\* \\? \\: \\\ \\/} |
54 |
}; |
55 |
|
56 |
my $query = q{+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /}; |
57 |
for my $engine ( @engines ){ |
58 |
t::lib::Mocks::mock_preference( 'SearchEngine', $engine ); |
59 |
my $searcher = Koha::SearchEngine::Search->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); |
60 |
is( $searcher->escape_query( $query ), $expected->{$engine},"Query is escaped as expected"); |
61 |
} |
62 |
}; |
63 |
|
47 |
# -- Helper routine |
64 |
# -- Helper routine |
48 |
sub test_record { |
65 |
sub test_record { |
49 |
my $marc = MARC::Record->new; |
66 |
my $marc = MARC::Record->new; |
50 |
- |
|
|