|
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 => 81; |
7 |
use Test::More tests => 82; |
| 8 |
|
8 |
|
| 9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
| 10 |
use Test::Warn; |
10 |
use Test::Warn; |
|
Lines 262-267
$module_context->mock(
Link Here
|
| 262 |
$dt = dt_from_string('2014-03-30 02:00:00'); |
262 |
$dt = dt_from_string('2014-03-30 02:00:00'); |
| 263 |
isa_ok( $dt, 'DateTime', 'dt_from_string should return a DateTime object if a DST is given' ); |
263 |
isa_ok( $dt, 'DateTime', 'dt_from_string should return a DateTime object if a DST is given' ); |
| 264 |
|
264 |
|
|
|
265 |
# Test output_pref for invalid local time explosion |
| 266 |
$dt = DateTime->new( |
| 267 |
year => 2017, |
| 268 |
month => 03, |
| 269 |
day => 26, |
| 270 |
hour => 01, |
| 271 |
minute => 35, |
| 272 |
); |
| 273 |
$module_context->mock( |
| 274 |
'tz', |
| 275 |
sub { |
| 276 |
return DateTime::TimeZone->new( name => 'Europe/London' ); |
| 277 |
} |
| 278 |
); |
| 279 |
is( output_pref( { dt => $dt, dateonly => 0 } ), '03/26/2017 01:35', 'output_pref should return even if an invalid DST time is passed' ); |
| 280 |
|
| 265 |
# Test dt_from_string |
281 |
# Test dt_from_string |
| 266 |
t::lib::Mocks::mock_preference('dateformat', 'metric'); |
282 |
t::lib::Mocks::mock_preference('dateformat', 'metric'); |
| 267 |
t::lib::Mocks::mock_preference('TimeFormat', '24hr'); |
283 |
t::lib::Mocks::mock_preference('TimeFormat', '24hr'); |
| 268 |
- |
|
|