From 3a39c771dad706653bc8b07d71607a37afbd5b86 Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Fri, 9 Jun 2017 23:03:34 -0400
Subject: [PATCH] [SIGNED OFF] Bug 18762: Catch noisy Search.t

Seems that the grs1 case for ti:punctuation generates a warning,
while the dom case does not. This tweak catches both.

before patch: noisy.
after patch: no unexpected output.
run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
I ran reset_all in kohadevbox. This patch clears
up the extra noise correctly now and passes QA tools.
---
 t/db_dependent/Search.t | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t
index c8cbc48..d376913 100644
--- a/t/db_dependent/Search.t
+++ b/t/db_dependent/Search.t
@@ -661,8 +661,16 @@ if ( $indexing_mode eq 'dom' ) {
     ok(!exists($newresults[0]->{norequests}), 'presence of a transit does not block hold request action (bug 10741)');
 
     ## Regression test for bug 10684
-    ( undef, $results_hashref, $facets_loop ) =
-        getRecords('ti:punctuation', 'punctuation', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
+    my $expected_warning = $indexing_mode eq 'grs1' ?
+        qr/^ERROR DECODING RECORD - Tag "50%" is not a valid tag/ :
+        undef;
+    my $expected_description = $indexing_mode eq 'grs1' ?
+        "Warning is raised correctly for ti:punctuation MARC::Record" :
+        "No warning is raised as expected for ti:punctuation MARC::Record";
+    warning_like { ( undef, $results_hashref, $facets_loop ) =
+        getRecords('ti:punctuation', 'punctuation', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef)
+        }
+        $expected_warning, $expected_description;
     is($results_hashref->{biblioserver}->{hits}, 1, "search for ti:punctuation returned expected number of records");
     warning_like { @newresults = searchResults('intranet', $query_desc,
                     $results_hashref->{'biblioserver'}->{'hits'}, 20, 0, 0,
@@ -966,12 +974,12 @@ sub run_unimarc_search_tests {
 }
 
 subtest 'MARC21 + GRS-1' => sub {
-    plan tests => 109;
+    plan tests => 110;
     run_marc21_search_tests('grs1');
 };
 
 subtest 'MARC21 + DOM' => sub {
-    plan tests => 109;
+    plan tests => 110;
     run_marc21_search_tests('dom');
 };
 
-- 
2.1.4