Bug 25882: Unit test
authorNick Clemens <nick@bywatersolutions.com>
Fri, 26 Jun 2020 13:19:32 +0000 (13:19 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 12 Aug 2020 09:46:19 +0000 (11:46 +0200)
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

index a9d886e..1266da5 100644 (file)
@@ -216,7 +216,7 @@ subtest 'build_authorities_query_compat() tests' => sub {
 };
 
 subtest 'build_query tests' => sub {
-    plan tests => 52;
+    plan tests => 53;
 
     my $qb;
 
@@ -481,6 +481,13 @@ subtest 'build_query tests' => sub {
     is($query_cgi, 'idx=&q=title%3A%22donald%20duck%22', 'query cgi');
     is($query_desc, 'title:"donald duck"', 'query desc ok');
 
+    ( undef, $query ) = $qb->build_query_compat( ['AND'], ['title:"donald duck"'], undef, ['author:Dillinger Escaplan', 'mc-itype,phr:BOOK', 'mc-itype,phr:CD'] );
+    is(
+        $query->{query}{query_string}{query},
+        '(title:"donald duck") AND (author:("Dillinger Escaplan")) AND itype:(("BOOK") OR ("CD"))',
+        "Limits quoted correctly when passed as phrase"
+    );
+
     # Scan queries
     ( undef, $query, $simple_query, $query_cgi, $query_desc ) = $qb->build_query_compat( undef, ['new'], ['au'], undef, undef, 1 );
     is(