Lines 17-28
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 5; |
20 |
use Test::More tests => 6; |
21 |
use t::lib::TestBuilder; |
21 |
use t::lib::TestBuilder; |
22 |
|
22 |
|
23 |
use DateTime; |
23 |
use DateTime; |
24 |
use Koha::Caches; |
24 |
use Koha::Caches; |
25 |
use Koha::DateUtils; |
25 |
use Koha::DateUtils; |
|
|
26 |
use POSIX qw(tzset); |
26 |
|
27 |
|
27 |
use_ok('Koha::Calendar'); |
28 |
use_ok('Koha::Calendar'); |
28 |
|
29 |
|
Lines 66-69
is($forwarded_dt->ymd, $today->ymd, '0 day should return start dt');
Link Here
|
66 |
$forwarded_dt = $calendar->days_forward($today, -2); |
67 |
$forwarded_dt = $calendar->days_forward($today, -2); |
67 |
is($forwarded_dt->ymd, $today->ymd, 'negative day should return start dt'); |
68 |
is($forwarded_dt->ymd, $today->ymd, 'negative day should return start dt'); |
68 |
|
69 |
|
|
|
70 |
subtest 'crossing_DST' => sub { |
71 |
|
72 |
plan tests => 2; |
73 |
|
74 |
$ENV{TZ} = 'America/New_York'; |
75 |
tzset; |
76 |
my $tz = DateTime::TimeZone->new( name => 'local' ); |
77 |
my $start_date = dt_from_string( "2016-03-09 02:29:00",undef,$tz ); |
78 |
my $end_date = dt_from_string("2017-01-01"); |
79 |
my $days_between = $calendar->days_between($start_date,$end_date); |
80 |
is($days_between->{days}, 298, "Days calculated correctly"); |
81 |
my $hours_between = $calendar->hours_between($start_date,$end_date); |
82 |
is($hours_between->{minutes}, 428671, "Hours (in minutes) calculated correctly"); |
83 |
|
84 |
}; |
85 |
|
69 |
$schema->storage->txn_rollback(); |
86 |
$schema->storage->txn_rollback(); |
70 |
- |
|
|