mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fixing whitespace and removig calls to Helper::output() introduced by error
This commit is contained in:
parent
0b3758dc91
commit
09b466f8aa
4 changed files with 72 additions and 74 deletions
|
@ -524,21 +524,21 @@ class I18n extends Object {
|
||||||
*/
|
*/
|
||||||
function __parseLiteralValue($string) {
|
function __parseLiteralValue($string) {
|
||||||
$string = $string[1];
|
$string = $string[1];
|
||||||
if (substr($string,0,2) === $this->__escape . 'x') {
|
if (substr($string, 0, 2) === $this->__escape . 'x') {
|
||||||
$delimiter = $this->__escape . 'x';
|
$delimiter = $this->__escape . 'x';
|
||||||
return join('',array_map('chr',array_map('hexdec',array_filter(explode($delimiter,$string)))));
|
return join('',array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string)))));
|
||||||
}
|
}
|
||||||
if (substr($string,0,2) === $this->__escape . 'd') {
|
if (substr($string, 0, 2) === $this->__escape . 'd') {
|
||||||
$delimiter = $this->__escape . 'd';
|
$delimiter = $this->__escape . 'd';
|
||||||
return join('',array_map('chr',array_filter(explode($delimiter,$string))));
|
return join('',array_map('chr', array_filter(explode($delimiter, $string))));
|
||||||
}
|
}
|
||||||
if ($string[0] === $this->__escape && isset($string[1]) && is_numeric($string[1])) {
|
if ($string[0] === $this->__escape && isset($string[1]) && is_numeric($string[1])) {
|
||||||
$delimiter = $this->__escape;
|
$delimiter = $this->__escape;
|
||||||
return join('',array_map('chr',array_filter(explode($delimiter,$string))));
|
return join('', array_map('chr', array_filter(explode($delimiter, $string))));
|
||||||
}
|
}
|
||||||
if (substr($string,0,3) === 'U00') {
|
if (substr($string, 0, 3) === 'U00') {
|
||||||
$delimiter = 'U00';
|
$delimiter = 'U00';
|
||||||
return join('',array_map('chr',array_map('hexdec',array_filter(explode($delimiter,$string)))));
|
return join('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
|
||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ class I18n extends Object {
|
||||||
* @return mixed translated format string if only value or array of translated strings for corresponding format.
|
* @return mixed translated format string if only value or array of translated strings for corresponding format.
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __translateTime($format,$domain) {
|
function __translateTime($format, $domain) {
|
||||||
if (!empty($this->__domains['LC_TIME'][$this->__lang][$domain][$format])) {
|
if (!empty($this->__domains['LC_TIME'][$this->__lang][$domain][$format])) {
|
||||||
if (($trans = $this->__domains[$this->category][$this->__lang][$domain][$format])) {
|
if (($trans = $this->__domains[$this->category][$this->__lang][$domain][$format])) {
|
||||||
return $trans;
|
return $trans;
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TimeHelper extends AppHelper {
|
||||||
$time = time();
|
$time = time();
|
||||||
}
|
}
|
||||||
$this->__time = $time;
|
$this->__time = $time;
|
||||||
return preg_replace_callback('/\%(\w+)/',array($this,'__translateSpecifier'),$format);
|
return preg_replace_callback('/\%(\w+)/', array($this, '__translateSpecifier'), $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,21 +54,21 @@ class TimeHelper extends AppHelper {
|
||||||
function __translateSpecifier($specifier) {
|
function __translateSpecifier($specifier) {
|
||||||
switch ($specifier[1]) {
|
switch ($specifier[1]) {
|
||||||
case 'a':
|
case 'a':
|
||||||
$abday = __c('abday',5,true);
|
$abday = __c('abday', 5, true);
|
||||||
if (is_array($abday)) {
|
if (is_array($abday)) {
|
||||||
return $abday[date('w',$this->__time)];
|
return $abday[date('w', $this->__time)];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
$day = __c('day',5,true);
|
$day = __c('day',5,true);
|
||||||
if (is_array($day)) {
|
if (is_array($day)) {
|
||||||
return $day[date('w',$this->__time)];
|
return $day[date('w', $this->__time)];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
$format = __c('d_t_fmt',5,true);
|
$format = __c('d_t_fmt',5,true);
|
||||||
if ($format != 'd_t_fmt') {
|
if ($format != 'd_t_fmt') {
|
||||||
return $this->convertSpecifiers($format,$this->__time);
|
return $this->convertSpecifiers($format, $this->__time);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
|
@ -76,18 +76,18 @@ class TimeHelper extends AppHelper {
|
||||||
case 'D':
|
case 'D':
|
||||||
return '%m/%d/%y';
|
return '%m/%d/%y';
|
||||||
case 'eS' :
|
case 'eS' :
|
||||||
return date('jS',$this->__time);
|
return date('jS', $this->__time);
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'h':
|
case 'h':
|
||||||
$months = __c('abmon',5,true);
|
$months = __c('abmon', 5, true);
|
||||||
if (is_array($months)) {
|
if (is_array($months)) {
|
||||||
return $months[date('n',$this->__time) -1];
|
return $months[date('n', $this->__time) -1];
|
||||||
}
|
}
|
||||||
return '%b';
|
return '%b';
|
||||||
case 'B':
|
case 'B':
|
||||||
$months = __c('mon',5,true);
|
$months = __c('mon',5,true);
|
||||||
if (is_array($months)) {
|
if (is_array($months)) {
|
||||||
return $months[date('n',$this->__time) -1];
|
return $months[date('n', $this->__time) -1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -96,16 +96,16 @@ class TimeHelper extends AppHelper {
|
||||||
case 'P':
|
case 'P':
|
||||||
$default = array('am' => 0, 'pm' => 1);
|
$default = array('am' => 0, 'pm' => 1);
|
||||||
$meridiem = $default[date('a',$this->__time)];
|
$meridiem = $default[date('a',$this->__time)];
|
||||||
$format = __c('am_pm',5,true);
|
$format = __c('am_pm', 5, true);
|
||||||
if (is_array($format)) {
|
if (is_array($format)) {
|
||||||
$meridiem = $format[$meridiem];
|
$meridiem = $format[$meridiem];
|
||||||
return ($specifier[1] == 'P') ? strtolower($meridiem) : strtoupper($meridiem);
|
return ($specifier[1] == 'P') ? strtolower($meridiem) : strtoupper($meridiem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
$complete = __c('t_fmt_ampm',5,true);
|
$complete = __c('t_fmt_ampm', 5, true);
|
||||||
if ($complete != 't_fmt_ampm') {
|
if ($complete != 't_fmt_ampm') {
|
||||||
return str_replace('%p',$this->__translateSpecifier(array('%p','p')),$complete);
|
return str_replace('%p',$this->__translateSpecifier(array('%p', 'p')),$complete);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
|
@ -117,15 +117,15 @@ class TimeHelper extends AppHelper {
|
||||||
case 'u':
|
case 'u':
|
||||||
return ($weekDay = date('w', $this->__time)) ? $weekDay : 7;
|
return ($weekDay = date('w', $this->__time)) ? $weekDay : 7;
|
||||||
case 'x':
|
case 'x':
|
||||||
$format = __c('d_fmt',5,true);
|
$format = __c('d_fmt', 5, true);
|
||||||
if ($format != 'd_fmt') {
|
if ($format != 'd_fmt') {
|
||||||
return $this->convertSpecifiers($format,$this->__time);
|
return $this->convertSpecifiers($format, $this->__time);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
$format = __c('t_fmt',5,true);
|
$format = __c('t_fmt',5,true);
|
||||||
if ($format != 't_fmt') {
|
if ($format != 't_fmt') {
|
||||||
return $this->convertSpecifiers($format,$this->__time);
|
return $this->convertSpecifiers($format, $this->__time);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -190,9 +190,8 @@ class TimeHelper extends AppHelper {
|
||||||
} else {
|
} else {
|
||||||
$date = time();
|
$date = time();
|
||||||
}
|
}
|
||||||
$format = $this->convertSpecifiers('%a, %b %eS %Y, %H:%M',$date);
|
$format = $this->convertSpecifiers('%a, %b %eS %Y, %H:%M', $date);
|
||||||
$ret = strftime($format, $date);
|
return strftime($format, $date);
|
||||||
return $this->output($ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,11 +216,11 @@ class TimeHelper extends AppHelper {
|
||||||
} elseif ($this->wasYesterday($date)) {
|
} elseif ($this->wasYesterday($date)) {
|
||||||
$ret = sprintf(__('Yesterday, %s',true), strftime("%H:%M", $date));
|
$ret = sprintf(__('Yesterday, %s',true), strftime("%H:%M", $date));
|
||||||
} else {
|
} else {
|
||||||
$format = $this->convertSpecifiers("%b %eS{$y}, %H:%M",$date);
|
$format = $this->convertSpecifiers("%b %eS{$y}, %H:%M", $date);
|
||||||
$ret = strftime($format, $date);
|
$ret = strftime($format, $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->output($ret);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,8 +238,7 @@ class TimeHelper extends AppHelper {
|
||||||
$begin = date('Y-m-d', $begin) . ' 00:00:00';
|
$begin = date('Y-m-d', $begin) . ' 00:00:00';
|
||||||
$end = date('Y-m-d', $end) . ' 23:59:59';
|
$end = date('Y-m-d', $end) . ' 23:59:59';
|
||||||
|
|
||||||
$ret ="($fieldName >= '$begin') AND ($fieldName <= '$end')";
|
return "($fieldName >= '$begin') AND ($fieldName <= '$end')";
|
||||||
return $this->output($ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -255,7 +253,7 @@ class TimeHelper extends AppHelper {
|
||||||
function dayAsSql($dateString, $fieldName, $userOffset = null) {
|
function dayAsSql($dateString, $fieldName, $userOffset = null) {
|
||||||
$date = $this->fromString($dateString, $userOffset);
|
$date = $this->fromString($dateString, $userOffset);
|
||||||
$ret = $this->daysAsSql($dateString, $dateString, $fieldName);
|
$ret = $this->daysAsSql($dateString, $dateString, $fieldName);
|
||||||
return $this->output($ret);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,7 +357,7 @@ class TimeHelper extends AppHelper {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->output($date);
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,7 +369,7 @@ class TimeHelper extends AppHelper {
|
||||||
*/
|
*/
|
||||||
function toUnix($dateString, $userOffset = null) {
|
function toUnix($dateString, $userOffset = null) {
|
||||||
$ret = $this->fromString($dateString, $userOffset);
|
$ret = $this->fromString($dateString, $userOffset);
|
||||||
return $this->output($ret);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +382,7 @@ class TimeHelper extends AppHelper {
|
||||||
function toAtom($dateString, $userOffset = null) {
|
function toAtom($dateString, $userOffset = null) {
|
||||||
$date = $this->fromString($dateString, $userOffset);
|
$date = $this->fromString($dateString, $userOffset);
|
||||||
$ret = date('Y-m-d\TH:i:s\Z', $date);
|
$ret = date('Y-m-d\TH:i:s\Z', $date);
|
||||||
return $this->output($ret);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -397,7 +395,7 @@ class TimeHelper extends AppHelper {
|
||||||
function toRSS($dateString, $userOffset = null) {
|
function toRSS($dateString, $userOffset = null) {
|
||||||
$date = $this->fromString($dateString, $userOffset);
|
$date = $this->fromString($dateString, $userOffset);
|
||||||
$ret = date("r", $date);
|
$ret = date("r", $date);
|
||||||
return $this->output($ret);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -577,7 +575,7 @@ class TimeHelper extends AppHelper {
|
||||||
$relativeDate = sprintf(__('%s ago', true), $relativeDate);
|
$relativeDate = sprintf(__('%s ago', true), $relativeDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->output($relativeDate);
|
return $relativeDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -656,7 +654,7 @@ class TimeHelper extends AppHelper {
|
||||||
|
|
||||||
if (is_numeric($_time) && $time === false) {
|
if (is_numeric($_time) && $time === false) {
|
||||||
$format = $date;
|
$format = $date;
|
||||||
return $this->i18nFormat($_time,$format,$invalid,$userOffset);
|
return $this->i18nFormat($_time, $format, $invalid, $userOffset);
|
||||||
}
|
}
|
||||||
if ($time === false && $invalid !== false) {
|
if ($time === false && $invalid !== false) {
|
||||||
return $invalid;
|
return $invalid;
|
||||||
|
@ -682,8 +680,8 @@ class TimeHelper extends AppHelper {
|
||||||
if (empty($format)) {
|
if (empty($format)) {
|
||||||
$format = '%x';
|
$format = '%x';
|
||||||
}
|
}
|
||||||
$format = $this->convertSpecifiers($format,$date);
|
$format = $this->convertSpecifiers($format, $date);
|
||||||
return strftime($format,$date);
|
return strftime($format, $date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -2593,15 +2593,15 @@ class I18nTest extends CakeTestCase {
|
||||||
Configure::write('Config.language', 'po');
|
Configure::write('Config.language', 'po');
|
||||||
$result = __c('d_fmt', 5, true);
|
$result = __c('d_fmt', 5, true);
|
||||||
$expected = '%m/%d/%Y';
|
$expected = '%m/%d/%Y';
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __c('am_pm',5,true);
|
$result = __c('am_pm', 5, true);
|
||||||
$expected = array('AM','PM');
|
$expected = array('AM', 'PM');
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __c('abmon',5,true);
|
$result = __c('abmon', 5, true);
|
||||||
$expected = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
|
$expected = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -664,79 +664,79 @@ class TimeHelperTest extends CakeTestCase {
|
||||||
Configure::write('Config.language', 'time_test');
|
Configure::write('Config.language', 'time_test');
|
||||||
$time = 1263485619; // Thu Jan 14 11:43:39 2010
|
$time = 1263485619; // Thu Jan 14 11:43:39 2010
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%a',$time);
|
$result = $this->Time->convertSpecifiers('%a', $time);
|
||||||
$expected = 'jue';
|
$expected = 'jue';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%A',$time);
|
$result = $this->Time->convertSpecifiers('%A', $time);
|
||||||
$expected = 'jueves';
|
$expected = 'jueves';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%c',$time);
|
$result = $this->Time->convertSpecifiers('%c', $time);
|
||||||
$expected = 'jue %d ene %Y %H:%M:%S %Z';
|
$expected = 'jue %d ene %Y %H:%M:%S %Z';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%C',$time);
|
$result = $this->Time->convertSpecifiers('%C', $time);
|
||||||
$expected = '20';
|
$expected = '20';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%D',$time);
|
$result = $this->Time->convertSpecifiers('%D', $time);
|
||||||
$expected = '%m/%d/%y';
|
$expected = '%m/%d/%y';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%b',$time);
|
$result = $this->Time->convertSpecifiers('%b', $time);
|
||||||
$expected = 'ene';
|
$expected = 'ene';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%h',$time);
|
$result = $this->Time->convertSpecifiers('%h', $time);
|
||||||
$expected = 'ene';
|
$expected = 'ene';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%B',$time);
|
$result = $this->Time->convertSpecifiers('%B', $time);
|
||||||
$expected = 'enero';
|
$expected = 'enero';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%n',$time);
|
$result = $this->Time->convertSpecifiers('%n', $time);
|
||||||
$expected = "\n";
|
$expected = "\n";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%n',$time);
|
$result = $this->Time->convertSpecifiers('%n', $time);
|
||||||
$expected = "\n";
|
$expected = "\n";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%p',$time);
|
$result = $this->Time->convertSpecifiers('%p', $time);
|
||||||
$expected = 'AM';
|
$expected = 'AM';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%P',$time);
|
$result = $this->Time->convertSpecifiers('%P', $time);
|
||||||
$expected = 'am';
|
$expected = 'am';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%r',$time);
|
$result = $this->Time->convertSpecifiers('%r', $time);
|
||||||
$expected = '%I:%M:%S AM';
|
$expected = '%I:%M:%S AM';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%R',$time);
|
$result = $this->Time->convertSpecifiers('%R', $time);
|
||||||
$expected = '11:43';
|
$expected = '11:43';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%t',$time);
|
$result = $this->Time->convertSpecifiers('%t', $time);
|
||||||
$expected = "\t";
|
$expected = "\t";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%T',$time);
|
$result = $this->Time->convertSpecifiers('%T', $time);
|
||||||
$expected = '%H:%M:%S';
|
$expected = '%H:%M:%S';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%u',$time);
|
$result = $this->Time->convertSpecifiers('%u', $time);
|
||||||
$expected = 4;
|
$expected = 4;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%x',$time);
|
$result = $this->Time->convertSpecifiers('%x', $time);
|
||||||
$expected = '%d/%m/%y';
|
$expected = '%d/%m/%y';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->convertSpecifiers('%X',$time);
|
$result = $this->Time->convertSpecifiers('%X', $time);
|
||||||
$expected = '%H:%M:%S';
|
$expected = '%H:%M:%S';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
@ -756,19 +756,19 @@ class TimeHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Time->i18nFormat($time);
|
$result = $this->Time->i18nFormat($time);
|
||||||
$expected = '14/01/10';
|
$expected = '14/01/10';
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->i18nFormat($time,'%c');
|
$result = $this->Time->i18nFormat($time, '%c');
|
||||||
$expected = 'jue 14 ene 2010 13:59:28 VET';
|
$expected = 'jue 14 ene 2010 13:59:28 VET';
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->i18nFormat($time,'Time is %r, and date is %x');
|
$result = $this->Time->i18nFormat($time, 'Time is %r, and date is %x');
|
||||||
$expected = 'Time is 01:59:28 PM, and date is 14/01/10';
|
$expected = 'Time is 01:59:28 PM, and date is 14/01/10';
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = $this->Time->i18nFormat('invalid date','%x','Date invalid');
|
$result = $this->Time->i18nFormat('invalid date', '%x', 'Date invalid');
|
||||||
$expected = 'Date invalid';
|
$expected = 'Date invalid';
|
||||||
$this->assertEqual($result,$expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -779,8 +779,8 @@ class TimeHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
function testFormatNewSyntax() {
|
function testFormatNewSyntax() {
|
||||||
$time = time();
|
$time = time();
|
||||||
$this->assertEqual($this->Time->format($time),$this->Time->i18nFormat($time));
|
$this->assertEqual($this->Time->format($time), $this->Time->i18nFormat($time));
|
||||||
$this->assertEqual($this->Time->format($time,'%c'),$this->Time->i18nFormat($time,'%c'));
|
$this->assertEqual($this->Time->format($time, '%c'), $this->Time->i18nFormat($time, '%c'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue