From ae65f876ff32d0ea07d134ff0ef5ed5e5ed17e0e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Oct 2019 12:29:23 +0200 Subject: [PATCH] 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 --- t/db_dependent/Circulation.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index e323508469..af439b71f0 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -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; } ); -- 2.20.1