Bug 10684: add regression test

This patch adds a regression test for Koha's ability
to gracefully handle records that Zebra will index but
which MARC::Record won't parse.  In particular, MARC::File::USMARC
croaks on records that contain non-alphanumeric characters in the
tag name.

To test:

[1] After applying this test, run prove -v t/db_dependent/Search.t
    The test script will die when it gets to the regression test.
[2] After applying the main patches that fix the bug, the test
    script should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7e6364baee)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Galen Charlton 2013-11-14 16:50:37 +00:00 committed by Tomas Cohen Arazi
parent da1443882c
commit 47f8ca876d
2 changed files with 11 additions and 3 deletions

View File

@ -12,7 +12,7 @@ use YAML;
use C4::Debug;
require C4::Context;
use Test::More tests => 79;
use Test::More tests => 81;
use Test::MockModule;
use MARC::Record;
use File::Spec;
@ -412,7 +412,7 @@ $query_desc, $limit, $limit_cgi, $limit_desc,
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=_ALLRECORDS @attr 2=103 ""' ], [], [], [], 0, 'en');
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
is($results_hashref->{biblioserver}->{hits}, 178, "getRecords on _ALLRECORDS PQF returned all records");
is($results_hashref->{biblioserver}->{hits}, 179, "getRecords on _ALLRECORDS PQF returned all records");
( $error, $query, $simple_query, $query_cgi,
$query_desc, $limit, $limit_cgi, $limit_desc,
@ -534,6 +534,14 @@ $circ_module->mock('GetTransfers', sub {
$results_hashref->{'biblioserver'}->{"RECORDS"});
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);
is($results_hashref->{biblioserver}->{hits}, 1, "search for ti:punctuation returned expected number of records");
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 20, 0, 0,
$results_hashref->{'biblioserver'}->{"RECORDS"});
is(scalar(@newresults), 0, 'a record that cannot be parsed by MARC::Record is simply skipped (bug 10684)');
END {
if ($child) {
kill 9, $child;

File diff suppressed because one or more lines are too long