Bug 23234: Mock DateTime->now using the time zone

The timezone of the two dt was different, one was UTC, the other one was
my local one.
When we mocked DateTime->now we did not use the time zone, we must use
dt_from_string instead

Test plan:
Make sure your environment has a different time zone than UTC
`prove t/db_dependent/Circulation.t` should fail without this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-10-24 12:29:23 +02:00 committed by Martin Renvoize
parent c4466e7d71
commit 549a09c521
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -101,7 +101,7 @@ my $builder = t::lib::TestBuilder->new;
my $dbh = C4::Context->dbh;
# Prevent random failures by mocking ->now
my $now_value = DateTime->now();
my $now_value = dt_from_string;
my $mocked_datetime = Test::MockModule->new('DateTime');
$mocked_datetime->mock( 'now', sub { return $now_value->clone; } );