Bug 32878: (QA follow-up) Unit test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-02-16 15:26:07 +00:00 committed by Tomas Cohen Arazi
parent 375fbd1704
commit a116216732
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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');
};