Lines 5-12
use DateTime;
Link Here
|
5 |
use DateTime::TimeZone; |
5 |
use DateTime::TimeZone; |
6 |
|
6 |
|
7 |
use C4::Context; |
7 |
use C4::Context; |
8 |
use Test::More tests => 34; |
8 |
use Test::More tests => 37; |
9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
|
|
10 |
use Time::HiRes qw/ gettimeofday /; |
10 |
|
11 |
|
11 |
BEGIN { use_ok('Koha::DateUtils'); } |
12 |
BEGIN { use_ok('Koha::DateUtils'); } |
12 |
|
13 |
|
Lines 77-82
isa_ok( $new_dt, 'DateTime', 'Create DateTime with different timezone' );
Link Here
|
77 |
cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, |
78 |
cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, |
78 |
'Returned Dublin object matches input' ); |
79 |
'Returned Dublin object matches input' ); |
79 |
|
80 |
|
|
|
81 |
for ( qw/ 2014-01-01 2100-01-01 9999-01-01 / ) { |
82 |
my $duration = gettimeofday(); |
83 |
$new_dt = dt_from_string($_, 'iso', $dear_dirty_dublin); |
84 |
$duration = gettimeofday() - $duration; |
85 |
cmp_ok $duration, '<', 1, "Create DateTime $_ with TZ in less than 1s"; |
86 |
} |
87 |
|
80 |
$new_dt = dt_from_string( '2011-06-16 12:00', 'sql' ); |
88 |
$new_dt = dt_from_string( '2011-06-16 12:00', 'sql' ); |
81 |
isa_ok( $new_dt, 'DateTime', 'Create DateTime from (mysql) sql' ); |
89 |
isa_ok( $new_dt, 'DateTime', 'Create DateTime from (mysql) sql' ); |
82 |
cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, 'sql returns correct date' ); |
90 |
cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, 'sql returns correct date' ); |
Lines 145-147
$date_string = output_pref({ dt => $dt, dateformat => 'metric', timeformat => '2
Link Here
|
145 |
cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)'; |
153 |
cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)'; |
146 |
$date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 }); |
154 |
$date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 }); |
147 |
cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)'; |
155 |
cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)'; |
148 |
- |
156 |
|
|
|
157 |
|