Skip to content

Commit

Permalink
Getting the time helper code coverage up to 99%
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8228 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
DarkAngelBGE committed Jul 11, 2009
1 parent 11c6641 commit 44fa8d5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cake/tests/cases/libs/view/helpers/time.test.php
Expand Up @@ -276,6 +276,23 @@ function testTimeAgoInWords() {
$fourHours = $this->Time->timeAgoInWords(strtotime('-5 days, -2 hours'), array('userOffset' => -4));
$result = $this->Time->timeAgoInWords(strtotime('-5 days, -2 hours'), array('userOffset' => 4));
$this->assertEqual($fourHours, $result);

$result = $this->Time->timeAgoInWords(strtotime('-2 hours'));
$expected = '2 hours ago';
$this->assertEqual($expected, $result);

$result = $this->Time->timeAgoInWords(strtotime('-12 minutes'));
$expected = '12 minutes ago';
$this->assertEqual($expected, $result);

$result = $this->Time->timeAgoInWords(strtotime('-12 seconds'));
$expected = '12 seconds ago';
$this->assertEqual($expected, $result);

$time = strtotime('-3 years -12 months');
$result = $this->Time->timeAgoInWords($time);
$expected = 'on ' . date('j/n/y', $time);
$this->assertEqual($expected, $result);
}
/**
* testRelative method
Expand Down

0 comments on commit 44fa8d5

Please sign in to comment.