Fixing TimeHelper tests for the month of February

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6447 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-02-11 01:12:22 +00:00
parent cd8da1bd18
commit ba98d6cc12

View file

@ -86,8 +86,26 @@ class TimeTest extends UnitTestCase {
$result = $this->Time->timeAgoInWords(strtotime('2 months, 12 days'), array('end' => '3 month'));
$this->assertPattern('/2 months, 1 week/', $result);
$result = $this->Time->timeAgoInWords(strtotime('3 months, 5 days'), array('end' => '4 month'));
$this->assertEqual($result, '3 months, 4 days');
if (date('n') == '2') {
$result = $this->Time->timeAgoInWords(strtotime('3 months, 5 days'), array('end' => '4 month'));
$this->assertEqual($result, '3 months, 3 days');
$result = $this->Time->timeAgoInWords(strtotime('-2 months, -2 days'), array('end' => '3 month'));
$this->assertEqual($result, '2 months, 2 days ago');
$result = $this->Time->timeAgoInWords(strtotime('-2 months, -2 days'), array('end' => '3 month'));
$this->assertEqual($result, '2 months, 2 days ago');
} else {
// These tests fail in the month of February
$result = $this->Time->timeAgoInWords(strtotime('3 months, 5 days'), array('end' => '4 month'));
$this->assertEqual($result, '3 months, 4 days');
$result = $this->Time->timeAgoInWords(strtotime('-2 months, -2 days'), array('end' => '3 month'));
$this->assertEqual($result, '2 months, 1 day ago');
$result = $this->Time->timeAgoInWords(strtotime('-2 months, -2 days'), array('end' => '3 month'));
$this->assertEqual($result, '2 months, 1 day ago');
}
$result = $this->Time->timeAgoInWords(strtotime('2 months, 2 days'), array('end' => '3 month'));
$this->assertPattern('/2 months/', $result);
@ -95,9 +113,6 @@ class TimeTest extends UnitTestCase {
$result = $this->Time->timeAgoInWords(strtotime('2 months, 2 days'), array('end' => '1 month', 'format' => 'Y-m-d'));
$this->assertEqual($result, 'on ' . date('Y-m-d', strtotime('2 months, 2 days')));
$result = $this->Time->timeAgoInWords(strtotime('-2 months, -2 days'), array('end' => '3 month'));
$this->assertEqual($result, '2 months, 1 day ago');
$result = $this->Time->timeAgoInWords(strtotime('-2 months, -2 days'), array('end' => '1 month', 'format' => 'Y-m-d'));
$this->assertEqual($result, 'on ' . date('Y-m-d', strtotime('-2 months, -2 days')));
}