Bug 34489: Fix timezone problem in Patrons.t

See also bug 34930. Using same approach.

Test plan:
export TZ='Europe/Amsterdam'
prove t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6109a41ca6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f2228f40ab)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2023-09-27 14:13:45 +02:00 committed by Jacob O'Mara
parent e0964c19ec
commit ed23d3ea28
1 changed files with 16 additions and 0 deletions

View File

@ -742,6 +742,11 @@ subtest 'get_routing_lists' => sub {
subtest 'get_age' => sub {
plan tests => 31;
# Following tests implicitly assume timezone UTC
delete $C4::Context::context->{tz};
local %ENV;
$ENV{TZ} = 'Etc/UTC';
my $patron = $builder->build( { source => 'Borrower' } );
$patron = Koha::Patrons->find( $patron->{borrowernumber} );
@ -819,11 +824,19 @@ subtest 'get_age' => sub {
}
$patron->delete;
# Remove timezone change
delete $C4::Context::context->{tz};
};
subtest 'is_valid_age' => sub {
plan tests => 10;
# Following tests implicitly assume timezone UTC
delete $C4::Context::context->{tz};
local %ENV;
$ENV{TZ} = 'Etc/UTC';
my $dt = dt_from_string('2020-02-28');
Time::Fake->offset( $dt->epoch );
@ -901,6 +914,9 @@ subtest 'is_valid_age' => sub {
$patron->delete;
$category->delete;
# Remove timezone change
delete $C4::Context::context->{tz};
};
subtest 'account' => sub {