File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
cake/tests/cases/libs/view/helpers Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,23 @@ function testTimeAgoInWords() {
276
276
$ fourHours = $ this ->Time ->timeAgoInWords (strtotime ('-5 days, -2 hours ' ), array ('userOffset ' => -4 ));
277
277
$ result = $ this ->Time ->timeAgoInWords (strtotime ('-5 days, -2 hours ' ), array ('userOffset ' => 4 ));
278
278
$ this ->assertEqual ($ fourHours , $ result );
279
+
280
+ $ result = $ this ->Time ->timeAgoInWords (strtotime ('-2 hours ' ));
281
+ $ expected = '2 hours ago ' ;
282
+ $ this ->assertEqual ($ expected , $ result );
283
+
284
+ $ result = $ this ->Time ->timeAgoInWords (strtotime ('-12 minutes ' ));
285
+ $ expected = '12 minutes ago ' ;
286
+ $ this ->assertEqual ($ expected , $ result );
287
+
288
+ $ result = $ this ->Time ->timeAgoInWords (strtotime ('-12 seconds ' ));
289
+ $ expected = '12 seconds ago ' ;
290
+ $ this ->assertEqual ($ expected , $ result );
291
+
292
+ $ time = strtotime ('-3 years -12 months ' );
293
+ $ result = $ this ->Time ->timeAgoInWords ($ time );
294
+ $ expected = 'on ' . date ('j/n/y ' , $ time );
295
+ $ this ->assertEqual ($ expected , $ result );
279
296
}
280
297
/**
281
298
* testRelative method
You can’t perform that action at this time.
0 commit comments