Bug 30540: Unit test
This patch adds tests for checking the output_pref method against a timezone and datetime that would cause an Invalid local time failure To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/DateUtils.t => FAIL: The feature is not implemented, tests fail to complete Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
aa8e9fe5c5
commit
5bf08e4d49
1 changed files with 17 additions and 1 deletions
|
@ -4,7 +4,7 @@ use DateTime::TimeZone;
|
|||
|
||||
use C4::Context;
|
||||
|
||||
use Test::More tests => 81;
|
||||
use Test::More tests => 82;
|
||||
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
|
@ -262,6 +262,22 @@ $module_context->mock(
|
|||
$dt = dt_from_string('2014-03-30 02:00:00');
|
||||
isa_ok( $dt, 'DateTime', 'dt_from_string should return a DateTime object if a DST is given' );
|
||||
|
||||
# Test output_pref for invalid local time explosion
|
||||
$dt = DateTime->new(
|
||||
year => 2017,
|
||||
month => 03,
|
||||
day => 26,
|
||||
hour => 01,
|
||||
minute => 35,
|
||||
);
|
||||
$module_context->mock(
|
||||
'tz',
|
||||
sub {
|
||||
return DateTime::TimeZone->new( name => 'Europe/London' );
|
||||
}
|
||||
);
|
||||
is( output_pref( { dt => $dt, dateonly => 0 } ), '03/26/2017 01:35', 'output_pref should return even if an invalid DST time is passed' );
|
||||
|
||||
# Test dt_from_string
|
||||
t::lib::Mocks::mock_preference('dateformat', 'metric');
|
||||
t::lib::Mocks::mock_preference('TimeFormat', '24hr');
|
||||
|
|
Loading…
Reference in a new issue