mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Removing deprecated function TimeHelper::relativeTime() which was simply an alias for TimeHelper::timeAgoInWords()
This commit is contained in:
parent
709ed7675b
commit
1f2afd8d3f
2 changed files with 10 additions and 33 deletions
|
@ -77,7 +77,7 @@ class TimeHelper extends AppHelper {
|
|||
* @return string converted element
|
||||
* @access private
|
||||
*/
|
||||
function __translateSpecifier($specifier) {
|
||||
private function __translateSpecifier($specifier) {
|
||||
switch ($specifier[1]) {
|
||||
case 'a':
|
||||
$abday = __c('abday', 5);
|
||||
|
@ -643,22 +643,6 @@ class TimeHelper extends AppHelper {
|
|||
return $relativeDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for timeAgoInWords
|
||||
*
|
||||
* @param mixed $dateTime Datetime string (strtotime-compatible) or Unix timestamp
|
||||
* @param mixed $options Default format string, if timestamp is used in $dateTime, or an array of options to be passed
|
||||
* on to timeAgoInWords().
|
||||
* @return string Relative time string.
|
||||
* @see TimeHelper::timeAgoInWords
|
||||
* @access public
|
||||
* @deprecated This method alias will be removed in future versions.
|
||||
* @link http://book.cakephp.org/view/1471/Formatting
|
||||
*/
|
||||
function relativeTime($dateTime, $options = array()) {
|
||||
return $this->timeAgoInWords($dateTime, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if specified datetime was within the interval specified, else false.
|
||||
*
|
||||
|
|
|
@ -84,6 +84,12 @@ class TimeHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testTimeAgoInWords() {
|
||||
$result = $this->Time->timeAgoInWords('-1 week');
|
||||
$this->assertEqual($result, '1 week ago');
|
||||
|
||||
$result = $this->Time->timeAgoInWords('+1 week');
|
||||
$this->assertEqual($result, '1 week');
|
||||
|
||||
$result = $this->Time->timeAgoInWords(strtotime('+4 months +2 weeks +3 days'), array('end' => '8 years'), true);
|
||||
$this->assertEqual($result, '4 months, 2 weeks, 3 days');
|
||||
|
||||
|
@ -290,19 +296,6 @@ class TimeHelperTest extends CakeTestCase {
|
|||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRelative method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRelative() {
|
||||
$result = $this->Time->relativeTime('-1 week');
|
||||
$this->assertEqual($result, '1 week ago');
|
||||
$result = $this->Time->relativeTime('+1 week');
|
||||
$this->assertEqual($result, '1 week');
|
||||
}
|
||||
|
||||
/**
|
||||
* testNice method
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue