Bug 19816: Regression tests

This patch adds tests for the rfc3339 behaviour when dateonly => 1.

To test:
- Run:
  $ kshell
 k$ prove t/DateUtils.t
=> SUCCESS: Tests pass
- Apply this patch
- Run:
 k$ prove t/DateUtils.t
=> FAIL: dateonly is not implemented

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 7e69ab62a5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2019-01-24 14:27:28 -03:00 committed by Martin Renvoize
parent 491ad8fc33
commit 41115fc79d
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 4 additions and 1 deletions

View File

@ -4,7 +4,7 @@ use DateTime::TimeZone;
use C4::Context;
use Test::More tests => 67;
use Test::More tests => 68;
use Test::MockModule;
use Test::Warn;
@ -49,6 +49,9 @@ cmp_ok $date_string, 'eq', '2011-06-16 12:00 PM', 'iso output 12hr';
$date_string = output_pref({ dt => $dt, dateformat => 'rfc3339' });
like($date_string, qr/2011-06-16T12:00:00\+|-\d\d:\d\d/, 'RFC3339 output');
$date_string = output_pref({ dt => $dt, dateformat => 'rfc3339', dateonly => 1 });
is($date_string, '2011-06-16', 'RFC3339 output');
# "notime" doesn't actually mean anything in this context, but we
# can't pass undef or output_pref will try to access the database
$date_string = output_pref({ dt => $dt, dateformat => 'iso', timeformat => 'notime', dateonly => 1 });