Skip to content

Commit 44fa8d5

Browse files
author
DarkAngelBGE
committed
Getting the time helper code coverage up to 99%
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8228 3807eeeb-6ff5-0310-8944-8be069107fe0
1 parent 11c6641 commit 44fa8d5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

cake/tests/cases/libs/view/helpers/time.test.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,23 @@ function testTimeAgoInWords() {
276276
$fourHours = $this->Time->timeAgoInWords(strtotime('-5 days, -2 hours'), array('userOffset' => -4));
277277
$result = $this->Time->timeAgoInWords(strtotime('-5 days, -2 hours'), array('userOffset' => 4));
278278
$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);
279296
}
280297
/**
281298
* testRelative method

0 commit comments

Comments
 (0)