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 <gmc@esilibrary.com>
(cherry picked from commit c6f903198c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
5a250b20e2
commit
18c352b581
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue