From e1b97558080450c958a805a2f7a1ffd86f863c40 Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Wed, 12 Oct 2022 13:04:38 -0400 Subject: [PATCH] Bug 24860: (QA follow-up) Add unit tests to cover changes to Reserves.pm Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Holds.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index 3ed6e72f09..29e773e399 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -7,7 +7,7 @@ use t::lib::TestBuilder; use C4::Context; -use Test::More tests => 75; +use Test::More tests => 76; use Test::Exception; use MARC::Record; @@ -384,6 +384,12 @@ t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1' ); ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" ); t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1|1' ); ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" ); +t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '' ); +my $item_group_1 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store(); +my $item_group_2 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store(); +$item_group_1->add_item({ item_id => $itemnumber }); +$hold->item_group_id( $item_group_2->id )->update; +ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with non-matching item group" ); is( CanItemBeReserved( $patrons[0], $nfl_item)->{status}, 'itemAlreadyOnHold', "cannot request item that you have already reservedd" -- 2.39.5