mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Update tests for strfime() in timeAgoInWords()
Add test asserts for testTimeAgoInWordsWithFormat with strftime format
This commit is contained in:
parent
244acc724d
commit
d6abfcaf90
1 changed files with 15 additions and 3 deletions
|
@ -263,7 +263,7 @@ class CakeTimeTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test the format option of timeAgoInWords()
|
||||
* Test the format option of timeAgoInWords() with date() and strftime compatible strings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -271,8 +271,8 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$result = $this->Time->timeAgoInWords('2007-9-25', 'Y-m-d');
|
||||
$this->assertEquals('on 2007-09-25', $result);
|
||||
|
||||
$result = $this->Time->timeAgoInWords('2007-9-25', 'Y-m-d');
|
||||
$this->assertEquals('on 2007-09-25', $result);
|
||||
$result = $this->Time->timeAgoInWords('2007-9-25', '%x');
|
||||
$this->assertEquals('on '. strftime('%x', strtotime('2007-9-25')), $result);
|
||||
|
||||
$result = $this->Time->timeAgoInWords(
|
||||
strtotime('+2 weeks +2 days'),
|
||||
|
@ -280,11 +280,23 @@ class CakeTimeTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertRegExp('/^2 weeks, [1|2] day(s)?$/', $result);
|
||||
|
||||
$result = $this->Time->timeAgoInWords(
|
||||
strtotime('+2 weeks +2 days'),
|
||||
'%x'
|
||||
);
|
||||
$this->assertRegExp('/^2 weeks, [1|2] day(s)?$/', $result);
|
||||
|
||||
$result = $this->Time->timeAgoInWords(
|
||||
strtotime('+2 months +2 days'),
|
||||
array('end' => '1 month', 'format' => 'Y-m-d')
|
||||
);
|
||||
$this->assertEquals('on ' . date('Y-m-d', strtotime('+2 months +2 days')), $result);
|
||||
|
||||
$result = $this->Time->timeAgoInWords(
|
||||
strtotime('+2 months +2 days'),
|
||||
array('end' => '1 month', 'format' => '%x')
|
||||
);
|
||||
$this->assertEquals('on ' . strftime('%x', strtotime('+2 months +2 days')), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue