@@ -, +, @@ --- t/DateUtils.t | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/t/DateUtils.t +++ a/t/DateUtils.t @@ -3,7 +3,7 @@ use DateTime; use DateTime::TimeZone; use C4::Context; -use Test::More tests => 42; +use Test::More tests => 45; use Test::MockModule; use Time::HiRes qw/ gettimeofday /; @@ -162,3 +162,19 @@ cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and ti my $now = DateTime->now; is( dt_from_string, $now, "Without parameter, dt_from_string should return today" ); + +# Test dt_from_string + +$module_context->mock( + 'preference', + sub { + return 'metric'; + } +); + +$dt = dt_from_string( '31/01/2015' ); +is( ref($dt), 'DateTime' ); +$dt = eval { dt_from_string( '31/01/2015', 'iso' ); }; +is( ref($dt), '' ); +$dt = eval { dt_from_string( '01/01/2015', 'iso' ); }; +is( ref($dt), '' ); --