Bug 24295: Replace mock in t/db_dependent/Search.t

Replace the mock of GetTransfers in this test with a mock of transfers
data

Test plan
1/ Run t/db_dependent/Search.t
2/ Confirm it passes
3/ Apply patch
4/ Repeat steps 1-2

Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2021-11-09 11:38:06 +00:00 committed by Tomas Cohen Arazi
parent 3c6fb4edda
commit 02670978f3
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -31,6 +31,7 @@ use Test::MockModule;
use Test::Warn;
use t::lib::Mocks;
use t::lib::Mocks::Zebra;
use t::lib::TestBuilder;
use Koha::Caches;
@ -686,14 +687,18 @@ ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'
# make one of the test items appear to be in transit
my $circ_module = Test::MockModule->new('C4::Circulation');
$circ_module->mock('GetTransfers', sub {
my $itemnumber = shift // -1;
if ($itemnumber == 11) {
return ('2013-07-19', 'MPL', 'CPL');
} else {
return;
my $builder = t::lib::TestBuilder->new;
my $transfer = $builder->build(
{
source => 'Branchtransfer',
value => {
itemnumber => 11,
frombranch => 'MPL',
tobranch => 'CPL',
datesent => \'NOW()'
}
}
});
);
($error, $results_hashref, $facets_loop) = getRecords("TEST12121212","TEST12121212",[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0);
@newresults = searchResults({'interface'=>'intranet'}, $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0,