本文整理汇总了PHP中CMTest_TH::getVersionICU方法的典型用法代码示例。如果您正苦于以下问题:PHP CMTest_TH::getVersionICU方法的具体用法?PHP CMTest_TH::getVersionICU怎么用?PHP CMTest_TH::getVersionICU使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMTest_TH
的用法示例。
在下文中一共展示了CMTest_TH::getVersionICU方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRender
public function testRender()
{
$time = strtotime('2003-02-01 12:34');
foreach ([['params' => ['time' => $time], 'expected' => '2/1/03'], ['params' => ['time' => $time, 'showTime' => true], 'expected' => CMTest_TH::getVersionICU() < 50 ? '2/1/03 12:34 PM' : '2/1/03, 12:34 PM'], ['params' => ['time' => $time, 'showTime' => true, 'timeZone' => new DateTimeZone('US/Eastern')], 'expected' => CMTest_TH::getVersionICU() < 50 ? '2/1/03 7:34 AM' : '2/1/03, 7:34 AM'], ['params' => ['time' => $time, 'showTime' => true, 'timeZone' => 'US/Eastern'], 'expected' => CMTest_TH::getVersionICU() < 50 ? '2/1/03 7:34 AM' : '2/1/03, 7:34 AM'], ['params' => ['time' => $time, 'showWeekday' => true], 'expected' => 'Sat 2/1/03']] as $testData) {
$this->_assertSame($testData['expected'], $testData['params']);
}
}
示例2: testGetFormatterDateNumericalOverrideTimeZone
public function testGetFormatterDateNumericalOverrideTimeZone()
{
$time = new DateTime('2016-05-21 00:00:00', new DateTimeZone('UTC'));
$timeZone = DateTime::createFromFormat('O', '+02:00')->getTimezone();
$timeZoneOverride = DateTime::createFromFormat('O', '+03:00')->getTimezone();
$render = new CM_Frontend_Render(new CM_Frontend_Environment(null, null, null, $timeZone));
$formatter = $render->getFormatterDate(IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, null, $timeZoneOverride);
if (CMTest_TH::getVersionICU() < 50) {
$this->assertSame('5/21/16 3:00 AM', $formatter->format($time));
} else {
$this->assertSame('5/21/16, 3:00 AM', $formatter->format($time));
}
}