From f038fd121a92900f769e1d03b668460aadf91a8b Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 18 Apr 2014 21:51:09 +0000 Subject: [PATCH] Bug 11148: (follow-up) add more test cases Add test cases to exercise output_pref's as_due_date option when the time in question is not one minute before midnight. Signed-off-by: Galen Charlton (cherry picked from commit 9ccc602b7d5c41f27b09ff3aee437556eed680b1) Signed-off-by: Fridolin Somers --- t/DateUtils.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/DateUtils.t b/t/DateUtils.t index 8647de48c8..9afddc1bd6 100755 --- a/t/DateUtils.t +++ b/t/DateUtils.t @@ -5,7 +5,7 @@ use DateTime; use DateTime::TimeZone; use C4::Context; -use Test::More tests => 32; +use Test::More tests => 34; use Test::MockModule; BEGIN { use_ok('Koha::DateUtils'); } @@ -132,3 +132,16 @@ cmp_ok $date_string, 'eq', '11/12/2013', 'as_due_date with hours and timeformat $date_string = output_pref({ dt => $dt, dateformat => 'metric', timeformat => '12hr', dateonly => 1, as_due_date => 1}); cmp_ok $date_string, 'eq', '11/12/2013', 'as_due_date without hours and timeformat 12hr'; + +# Test as_due_date for hourly loans +$dt = DateTime->new( + year => 2013, + month => 12, + day => 11, + hour => 18, + minute => 35, +); +$date_string = output_pref({ dt => $dt, dateformat => 'metric', timeformat => '24hr', as_due_date => 1 }); +cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)'; +$date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 }); +cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)'; -- 2.39.5