From e29195c516ea4105e8e83aa3df50d99c3b88f9a7 Mon Sep 17 00:00:00 2001
From: David Cook <dcook@prosentient.com.au>
Date: Wed, 14 Dec 2022 05:17:02 +0000
Subject: [PATCH] Bug 20596: Add unit test for multiple values in authority
 search

This patch adds a unit test which returns 2 authority records
via an implicit OR when searching for strings from two different
authority records.

Test plan:
1. prove t/db_dependent/Search.t

Signed-off-by: Katrin <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
---
 t/db_dependent/Search.t | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t
index faa590bba5..b7b1fa8822 100755
--- a/t/db_dependent/Search.t
+++ b/t/db_dependent/Search.t
@@ -751,6 +751,13 @@ ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'
     );
     is($count, 1, 'MARC21 authorities: one hit on "all" (entire record) contains "professional wrestler"');
 
+    #NOTE: the 2nd parameter is unused in SearchAuthorities...
+    ($auths, $count) = SearchAuthorities(
+        ['Any','Any'], [''], [''], ['contains'],
+        ['professional wrestler','shakespeare'], 0, 10, '', '', 1
+    );
+    is($count, 2, 'MARC21 authorities: multiple values create operands implicitly joined by OR');
+
     # retrieve records that are larger than the MARC limit of 99,999 octets
     ( undef, $results_hashref, $facets_loop ) =
         getRecords('ti:marc the large record', '', [], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, 'ccl', undef);
@@ -923,7 +930,7 @@ sub run_unimarc_search_tests {
 }
 
 subtest 'MARC21 + DOM' => sub {
-    plan tests => 92;
+    plan tests => 93;
     run_marc21_search_tests();
 };
 
-- 
2.35.5