Bugzilla – Attachment 68580 Details for
Bug 9031
Overdue items crossing DST boundary throw invalid local time exception
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9031: (QA follow-up) Pass the same timezone in Calendar.t
Bug-9031-QA-follow-up-Pass-the-same-timezone-in-Ca.patch (text/plain), 1.96 KB, created by
Nick Clemens (kidclamp)
on 2017-10-26 09:52:28 UTC
(
hide
)
Description:
Bug 9031: (QA follow-up) Pass the same timezone in Calendar.t
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-10-26 09:52:28 UTC
Size:
1.96 KB
patch
obsolete
>From c2f88d40b29ec56e985ab1fb61dfe4929b89d14c Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 26 Oct 2017 09:13:38 +0200 >Subject: [PATCH] Bug 9031: (QA follow-up) Pass the same timezone in Calendar.t > >We do not need to change $ENV{TZ} or call tzset. >Pass $tz too for the second date. >Replace checking the datetime hash by delta calls. >Replacing the number of minutes. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >We will still crash with: >Invalid local time for date in time zone: America/New_York >But the changes in Calendar.pm will now resolve that. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Calendar.t | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > >diff --git a/t/db_dependent/Calendar.t b/t/db_dependent/Calendar.t >index 751cd86..b443420 100644 >--- a/t/db_dependent/Calendar.t >+++ b/t/db_dependent/Calendar.t >@@ -23,7 +23,6 @@ use t::lib::TestBuilder; > use DateTime; > use Koha::Caches; > use Koha::DateUtils; >-use POSIX qw(tzset); > > use_ok('Koha::Calendar'); > >@@ -71,15 +70,13 @@ subtest 'crossing_DST' => sub { > > plan tests => 2; > >- $ENV{TZ} = 'America/New_York'; >- tzset; >- my $tz = DateTime::TimeZone->new( name => 'local' ); >+ my $tz = DateTime::TimeZone->new( name => 'America/New_York' ); > my $start_date = dt_from_string( "2016-03-09 02:29:00",undef,$tz ); >- my $end_date = dt_from_string("2017-01-01"); >+ my $end_date = dt_from_string( "2017-01-01 00:00:00", undef, $tz ); > my $days_between = $calendar->days_between($start_date,$end_date); >- is($days_between->{days}, 298, "Days calculated correctly"); >+ is( $days_between->delta_days, 298, "Days calculated correctly" ); > my $hours_between = $calendar->hours_between($start_date,$end_date); >- is($hours_between->{minutes}, 428671, "Hours (in minutes) calculated correctly"); >+ is( $hours_between->delta_minutes, 298 * 24 * 60 - 149, "Hours (in minutes) calculated correctly" ); > > }; > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9031
:
13714
|
13795
|
61089
|
63718
|
64910
|
64911
|
68575
|
68576
|
68577
|
68578
|
68579
| 68580 |
68581
|
68582