From e5aac2298465e3b78398af5b17198bc527ca3d33 Mon Sep 17 00:00:00 2001 From: Christian Helbling Date: Tue, 7 Feb 2017 16:54:52 +0100 Subject: allow .time-1527 and .time-152715 as time formats for time debug parameter, add more tests for it::time() --- tests/it.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/it.t b/tests/it.t index 88fbbb9..e028f27 100755 --- a/tests/it.t +++ b/tests/it.t @@ -344,8 +344,19 @@ is( # it::date tests -$GLOBALS['debug_time'] = "2014-01-01"; -is(it::date(), "2014-01-01 00:00:00"); +function _time($debug_time, $expected) +{ + $GLOBALS['debug_time'] = $debug_time; + is(it::date(), $expected, ".time-$debug_time"); + $GLOBALS['debug_time'] = ''; +} +_time("2014-01-01", "2014-01-01 00:00:00"); +_time("2014-01-01-15-27-15", "2014-01-01 15:27:15"); +_time("15-27", it::date('', '15:27')); +_time("1527", it::date('', '15:27')); +_time("15-27-15", it::date('', '15:27:15')); +_time("152715", it::date('', '15:27:15')); +_time("yesterday", it::date('', 'yesterday')); is(it::date('date', '2011-10-25'), '25.10.2011', 'parse date string with strtotime'); is(it::date('date', '2011-10-25 + 3 days'), '28.10.2011', 'some date arithmetic'); -- cgit v1.2.3