From 9ee7673c7ea3e4990c116647d6c077a05e31cc93 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 29 Oct 2024 10:20:04 +0000 Subject: [PATCH] Bug 38233: Add regression tests prove t/db_dependent/ILSDI_Services.t Signed-off-by: Pedro Amorim Signed-off-by: Katrin Fischer --- t/db_dependent/ILSDI_Services.t | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index c7e728a3fb..df7e65a374 100755 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -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; }; -- 2.39.5