Bug 36567: Get rid of Datetime warning in Circulation.t and dateexpiry.t

Running either t/db_dependent/Circulation.t or t/db_dependent/Circulation/dateexpiry.t
cause following error to be dispalyed:

You are creating a DateTime object with a far future year (9999) and a time
zone (Europe/Helsinki). If the time zone you specified has future DST changes
this will be very slow.

Smallest allowed value is 4999, so we need to use that rather than 9999 in tests.

To test prove t/db_dependent/Circulation.t and t/db_dependent/Circulation/dateexpiry.t.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f5e9f9634f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Emmi Takkinen 2024-04-10 14:50:04 +03:00 committed by Fridolin Somers
parent 28c5cd8615
commit 6302ec6200
2 changed files with 5 additions and 5 deletions

View file

@ -2464,8 +2464,8 @@ subtest 'AddIssue & illrequests.due_date' => sub {
set_userenv($library);
my $custom_date_due = '9999-12-18 12:34:56';
my $expected_date_due = '9999-12-18 23:59:00';
my $custom_date_due = '4999-12-18 12:34:56';
my $expected_date_due = '4999-12-18 23:59:00';
my $illrequest = Koha::Illrequest->new({
borrowernumber => $patron->borrowernumber,
biblio_id => $item->biblionumber,
@ -2478,8 +2478,8 @@ subtest 'AddIssue & illrequests.due_date' => sub {
$patron = $builder->build_object( { class => 'Koha::Patrons' } );
$item = $builder->build_sample_item();
$custom_date_due = '9999-12-19';
$expected_date_due = '9999-12-19 23:59:00';
$custom_date_due = '4999-12-19';
$expected_date_due = '4999-12-19 23:59:00';
$illrequest = Koha::Illrequest->new({
borrowernumber => $patron->borrowernumber,
biblio_id => $item->biblionumber,

View file

@ -124,7 +124,7 @@ sub calc_date_due {
is( ref $d eq "DateTime" && $d->mdy() =~ /^\d+/, 1, "CalcDateDue with expiry tomorrow" );
# fourth test far future
$patron->dateexpiry('9876-12-31')->store;
$patron->dateexpiry('4999-12-31')->store;
my $t1 = time;
$d = C4::Circulation::CalcDateDue( $today, $item->effective_itemtype, $branch->{branchcode}, $patron );
my $t2 = time;