Skip to content
This repository
Browse code

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
  • Loading branch information...
commit 44fa8d5fd0eb9868d788179eeb95659470961238 1 parent 11c6641
Tim Koschuetzki authored July 11, 2009
17  cake/tests/cases/libs/view/helpers/time.test.php
@@ -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

0 notes on commit 44fa8d5

Please sign in to comment.
Something went wrong with that request. Please try again.