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 => 79; |
7 |
use Test::More tests => 80; |
8 |
|
8 |
|
9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
10 |
use Test::Warn; |
10 |
use Test::Warn; |
Lines 137-142
cmp_ok( $dt0->epoch(), 'eq', '1325462399', 'dt_from_string handles seconds with
Link Here
|
137 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999+02:00', 'rfc3339' ); |
137 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999+02:00', 'rfc3339' ); |
138 |
cmp_ok( $dt0->epoch(), 'eq', '1325455199', 'dt_from_string handles seconds with 3 decimal places and a timezone' ); |
138 |
cmp_ok( $dt0->epoch(), 'eq', '1325455199', 'dt_from_string handles seconds with 3 decimal places and a timezone' ); |
139 |
|
139 |
|
|
|
140 |
try { |
141 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999Z+02:00', 'rfc3339' ); |
142 |
} |
143 |
catch { |
144 |
like( $_, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad date string' ); |
145 |
}; |
146 |
|
140 |
# Return undef if passed mysql 0 dates |
147 |
# Return undef if passed mysql 0 dates |
141 |
$dt0 = dt_from_string( '0000-00-00', 'iso' ); |
148 |
$dt0 = dt_from_string( '0000-00-00', 'iso' ); |
142 |
is( $dt0, undef, "undefined returned for 0 iso date" ); |
149 |
is( $dt0, undef, "undefined returned for 0 iso date" ); |
143 |
- |
|
|