From c6f903198cf427b9e4c9f8ad89fef97518998a09 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 16 Aug 2013 00:33:24 +0000 Subject: [PATCH] Bug 10666: (follow-up) really fix the daily quotes test Koha::DateUtils::dt_from_string() and DateTime->now() are not equivalent -- they don't handle timezones in the same way. Signed-off-by: Galen Charlton --- t/db_dependent/Koha.t | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t index 500315f99a..9a5bf805e8 100644 --- a/t/db_dependent/Koha.t +++ b/t/db_dependent/Koha.t @@ -6,6 +6,7 @@ use strict; use warnings; use C4::Context; +use Koha::DateUtils qw(dt_from_string); use Test::More tests => 6; use DateTime::Format::MySQL; @@ -110,12 +111,12 @@ SKIP: my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?'; my $sth = C4::Context->dbh->prepare($query); - $sth->execute(DateTime::Format::MySQL->format_datetime(DateTime->now), $expected_quote->{'id'}); + $sth->execute(DateTime::Format::MySQL->format_datetime( dt_from_string() ), $expected_quote->{'id'}); - DateTime::Format::MySQL->format_datetime(DateTime->now) =~ m/(\d{4}-\d{2}-\d{2})/; + DateTime::Format::MySQL->format_datetime( dt_from_string() ) =~ m/(\d{4}-\d{2}-\d{2})/; $expected_quote->{'timestamp'} = re("^$1"); -# $expected_quote->{'timestamp'} = DateTime::Format::MySQL->format_datetime(DateTime->now); # update the timestamp of expected quote data +# $expected_quote->{'timestamp'} = DateTime::Format::MySQL->format_datetime( dt_from_string() ); # update the timestamp of expected quote data $quote = GetDailyQuote(); # this is the "default" mode of selection cmp_deeply ($quote, $expected_quote, "Got a quote based on today's date.") or -- 2.20.1