Bug 14784: (follow-up) Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit dd5a62b1fc)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Shi Yao Wang 2022-07-14 10:41:27 -04:00 committed by Matt Blenkinsop
parent 54976b2ea5
commit 1fc98e5c54

View file

@ -2617,7 +2617,7 @@ subtest 'AddReturn + CumulativeRestrictionPeriods' => sub {
};
subtest 'AddReturn + suspension_chargeperiod' => sub {
plan tests => 27;
plan tests => 29;
my $library = $builder->build( { source => 'Branch' } );
my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
@ -2847,6 +2847,47 @@ subtest 'AddReturn + suspension_chargeperiod' => sub {
}
);
Koha::CirculationRules->search->delete;
Koha::CirculationRules->set_rules(
{
categorycode => undef,
itemtype => undef,
branchcode => undef,
rules => {
finedays => 0,
}
}
);
Koha::Patron::Debarments::AddDebarment(
{
borrowernumber => $patron->{borrowernumber},
expiration => '9999-12-31',
type => 'MANUAL',
}
);
AddIssue( $patron, $item_1->barcode, $now->clone->subtract( days => 1 ) );
my ( undef, $message ) = AddReturn( $item_1->barcode, $library->{branchcode}, undef, $now );
is( $message->{WasReturned} && exists $message->{ForeverDebarred}, 1, 'Forever debarred message for Addreturn when overdue');
Koha::Patron::Debarments::DelUniqueDebarment(
{
borrowernumber => $patron->{borrowernumber},
type => 'MANUAL',
}
);
Koha::Patron::Debarments::AddDebarment(
{
borrowernumber => $patron->{borrowernumber},
expiration => $now->clone->add( days => 10 ),
type => 'MANUAL',
}
);
AddIssue( $patron, $item_1->barcode, $now->clone->subtract( days => 1 ) );
(undef, $message) = AddReturn( $item_1->barcode, $library->{branchcode}, undef, $now );
is( $message->{WasReturned} && exists $message->{PrevDebarred}, 1, 'Previously debarred message for Addreturn when overdue');
};
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub {