From e4bf0a4c9f6ef719d04ae97162befec9c5a6714c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 16 Feb 2023 15:26:07 +0000 Subject: [PATCH] Bug 32878: (QA follow-up) Unit test Signed-off-by: Kyle M Hall --- t/db_dependent/Circulation.t | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 2ecb44bec4..18e7ca271c 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -288,7 +288,7 @@ Koha::CirculationRules->set_rules( ); subtest "CanBookBeRenewed AllowRenewalIfOtherItemsAvailable multiple borrowers and items tests" => sub { - plan tests => 5; + plan tests => 7; #Can only reserve from home branch Koha::CirculationRules->set_rule( @@ -334,7 +334,7 @@ subtest "CanBookBeRenewed AllowRenewalIfOtherItemsAvailable multiple borrowers a is (defined $issue->date_due(), 1, "Item 1 checked out, due date: " . $issue->date_due() ); # Biblio-level holds - AddReserve( + my $reserve_1 = AddReserve( { branchcode => $patron_hold_1->branchcode, borrowernumber => $patron_hold_1->borrowernumber, @@ -370,6 +370,13 @@ subtest "CanBookBeRenewed AllowRenewalIfOtherItemsAvailable multiple borrowers a is( $renewokay, 1, 'Can renew, two items available for two holds'); is( $error, undef, 'Can renew, each reserve has an item'); + # Item level hold + my $hold = Koha::Holds->find( $reserve_1 ); + $hold->itemnumber( $item_1->itemnumber )->store; + + ( $renewokay, $error ) = CanBookBeRenewed($patron_borrower->borrowernumber, $item_1->itemnumber); + is( $renewokay, 0, 'Cannot renew when there is an item specific hold'); + is( $error, 'on_reserve', 'Cannot renew, only this item can fill the reserve'); }; -- 2.30.2