Bug 38233: Add regression tests

prove t/db_dependent/ILSDI_Services.t

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9ee7673c7e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2024-10-29 10:20:04 +00:00 committed by Lucas Gass
parent 89b6ef3e92
commit 46c9d1de2c
1 changed files with 25 additions and 1 deletions

View File

@ -760,7 +760,7 @@ subtest 'Holds test with start_date and end_date' => sub {
subtest 'GetRecords' => sub {
plan tests => 8;
plan tests => 10;
$schema->storage->txn_begin;
@ -825,6 +825,30 @@ subtest 'GetRecords' => sub {
is($reply_reserve->{biblionumber}, $item->biblionumber, 'GetRecords has a reserve tag');
is($reply_reserve->{borrowernumber}, undef, 'GetRecords does not expose borrowernumber in reserve tag');
# Check for hidelostitems sys pref
t::lib::Mocks::mock_preference( 'hidelostitems', 1 );
$item->itemlost(1)->store;
$cgi->param( service => 'GetRecords' );
$cgi->param( id => $item->biblionumber );
my $itemlost_reply = C4::ILSDI::Services::GetRecords($cgi);
is(
$itemlost_reply->{record}->[0]->{items}->{item}->[0], undef,
'GetRecords does not show lost items if hidelostitems = 1'
);
$item->itemlost(0)->store;
# Check for OpacHiddenItems sys pref
t::lib::Mocks::mock_preference( 'OpacHiddenItems', 'withdrawn: [1]' );
$item->withdrawn(1)->store;
$cgi->param( service => 'GetRecords' );
$cgi->param( id => $item->biblionumber );
my $itemwithdrawn_reply = C4::ILSDI::Services::GetRecords($cgi);
is(
$itemwithdrawn_reply->{record}->[0]->{items}->{item}->[0],
undef,
'GetRecords does not show withdrawn items if OpacHiddenItems contains \'withdrawn: [1]\''
);
$schema->storage->txn_rollback;
};