From 8e7379342d7cd8386baf884a77f54f95188bb85c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 23 Aug 2013 15:58:01 +0000 Subject: [PATCH] Bug 10741: (follow-up) add regression test Signed-off-by: Galen Charlton --- t/db_dependent/Search.t | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index d1f76a46d1..f915031c0f 100644 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -12,7 +12,7 @@ use YAML; use C4::Debug; require C4::Context; -use Test::More tests => 78; +use Test::More tests => 79; use Test::MockModule; use MARC::Record; use File::Spec; @@ -162,6 +162,9 @@ my $dbh = C4::Context->dbh; $dbh->{mock_add_resultset} = { sql => 'SHOW COLUMNS FROM items', results => [ + [ 'rows' ], # seems like $sth->rows is getting called + # implicitly, so we need this to make + # DBD::Mock return all of the results [ 'itemnumber' ], [ 'biblionumber' ], [ 'biblioitemnumber' ], [ 'barcode' ], [ 'dateaccessioned' ], [ 'booksellerid' ], [ 'homebranch' ], [ 'price' ], [ 'replacementprice' ], @@ -512,6 +515,25 @@ warning_like {( undef, $results_hashref, $facets_loop ) = $results_hashref->{'biblioserver'}->{"RECORDS"}); is($newresults[0]->{'alternateholdings_count'}, 1, 'Alternate holdings filled in correctly'); + +## Regression test for Bug 10741 + +# make one of the test items appear to be in transit +my $circ_module = new Test::MockModule('C4::Circulation'); +$circ_module->mock('GetTransfers', sub { + my $itemnumber = shift; + if ($itemnumber == 11) { + return ('2013-07-19', 'MPL', 'CPL'); + } else { + return; + } +}); + +($error, $results_hashref, $facets_loop) = getRecords("TEST12121212","TEST12121212",[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); +@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, + $results_hashref->{'biblioserver'}->{"RECORDS"}); +ok(!exists($newresults[0]->{norequests}), 'presence of a transit does not block hold request action (bug 10741)'); + END { if ($child) { kill 9, $child; -- 2.39.5