Bug 37966: Add test coverage for AddRenewal with empty due date

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Michael Hafen 2025-10-28 12:19:27 -06:00 committed by Lucas Gass
parent c84de245e3
commit 7dbaa5d77c
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 34 additions and 1 deletions

View File

@ -18,7 +18,7 @@
use Modern::Perl;
use Test::NoWarnings;
use Test::More tests => 68;
use Test::More tests => 69;
use DateTime::Duration;
use t::lib::Mocks;
@ -421,6 +421,39 @@ is_deeply(
"With issuing rules (renewal allowed, 1 remaining) and with a valid parameter, Getrenewcount of item1 returns 0 renews left"
);
# Check renewal due date when parameter due date is defined but empty
Koha::CirculationRules->set_rules(
{
categorycode => undef,
itemtype => undef,
branchcode => undef,
rules => {
renewalsallowed => 4,
}
}
);
my $datedue4 = AddRenewal(
{
borrowernumber => $borrower_id1,
itemnumber => $item_id1,
branch => $branchcode_1,
datedue => "",
lastreneweddate => $daysago10
}
);
my $datedue4_date = output_pref(
{
dt => $datedue4,
dateformat => 'iso',
timeformat => '24hr',
dateonly => 1
}
);
ok(
$datedue4_date ne $today,
q{AddRenewal with a defined but empty due date does not set the due date to today}
);
$dbh->do("DELETE FROM old_issues");
AddReturn($barcode_1);
my $return =