mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
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:
parent
cd8da1bd18
commit
ba98d6cc12
1 changed files with 20 additions and 5 deletions
|
@ -86,18 +86,33 @@ class TimeTest extends UnitTestCase {
|
|||
$result = $this->Time->timeAgoInWords(strtotime('2 months, 12 days'), array('end' => '3 month'));
|
||||
$this->assertPattern('/2 months, 1 week/', $result);
|
||||
|
||||
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);
|
||||
|
||||
$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')));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue