Lines 4-10
use DateTime::TimeZone;
Link Here
|
4 |
|
4 |
|
5 |
use C4::Context; |
5 |
use C4::Context; |
6 |
|
6 |
|
7 |
use Test::More tests => 68; |
7 |
use Test::More tests => 71; |
8 |
|
8 |
|
9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
10 |
use Test::Warn; |
10 |
use Test::Warn; |
Lines 125-130
isa_ok( $dt0, 'DateTime',
Link Here
|
125 |
'dt_from_string returns a DateTime object passed a zero rfc3339 day' ); |
125 |
'dt_from_string returns a DateTime object passed a zero rfc3339 day' ); |
126 |
cmp_ok( $dt0->ymd(), 'eq', $ymd, 'Returned object corrects rfc3339 day 0' ); |
126 |
cmp_ok( $dt0->ymd(), 'eq', $ymd, 'Returned object corrects rfc3339 day 0' ); |
127 |
|
127 |
|
|
|
128 |
$dt0 = dt_from_string( '2012-01-01T23:59:00.0Z', 'rfc3339' ); |
129 |
cmp_ok( $dt0->epoch(), 'eq', '1325462340', 'dt_from_string handles seconds with 1 decimal place' ); |
130 |
|
131 |
$dt0 = dt_from_string( '2012-01-01T23:59:00.00Z', 'rfc3339' ); |
132 |
cmp_ok( $dt0->epoch(), 'eq', '1325462340', 'dt_from_string handles seconds with 2 decimal places' ); |
133 |
|
134 |
$dt0 = dt_from_string( '2012-01-01T23:59:00.000Z', 'rfc3339' ); |
135 |
cmp_ok( $dt0->epoch(), 'eq', '1325462340', 'dt_from_string handles seconds with 3 decimal places' ); |
136 |
|
128 |
# Return undef if passed mysql 0 dates |
137 |
# Return undef if passed mysql 0 dates |
129 |
$dt0 = dt_from_string( '0000-00-00', 'iso' ); |
138 |
$dt0 = dt_from_string( '0000-00-00', 'iso' ); |
130 |
is( $dt0, undef, "undefined returned for 0 iso date" ); |
139 |
is( $dt0, undef, "undefined returned for 0 iso date" ); |
131 |
- |
|
|