|
|
|
@ -103,5 +103,21 @@ class FormatConverterTest extends TestCase
|
|
|
|
|
$expected = "'dDjlNSwZWFmMntLoYyaBghHisueIOPTZcru'"; |
|
|
|
|
$actual = FormatConverter::convertDatePhpToIcu('\d\D\j\l\N\S\w\Z\W\F\m\M\n\t\L\o\Y\y\a\B\g\h\H\i\s\u\e\I\O\P\T\Z\c\r\u'); |
|
|
|
|
$this->assertEquals($expected, $actual); |
|
|
|
|
|
|
|
|
|
$expected = "yyyy-MM-dd'T'HH:mm:ssxxx"; |
|
|
|
|
$actual = FormatConverter::convertDatePhpToIcu('c'); |
|
|
|
|
$this->assertEquals($expected, $actual); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testPhpFormatC() |
|
|
|
|
{ |
|
|
|
|
$time = time(); |
|
|
|
|
|
|
|
|
|
$formatter = new Formatter(['locale' => 'en-US']); |
|
|
|
|
$this->assertEquals(date('c', $time), $formatter->asDatetime($time, 'php:c')); |
|
|
|
|
|
|
|
|
|
date_default_timezone_set('Europe/Moscow'); |
|
|
|
|
$formatter = new Formatter(['locale' => 'ru-RU', 'timeZone' => 'Europe/Moscow']); |
|
|
|
|
$this->assertEquals(date('c', $time), $formatter->asDatetime($time, 'php:c')); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|