From 34dc400a81245beb1e384bd6391cb51d976a1c5e Mon Sep 17 00:00:00 2001 From: Evgeniy Sokolov Date: Sat, 20 Jun 2015 00:18:29 +0200 Subject: [PATCH] fix IntlDataFormatter default pattern --- .../Intl/DateFormatter/IntlDateFormatter.php | 2 +- .../Tests/DateFormatter/IntlDateFormatterTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php index 31eedfc3d31b3..9e7225a05e8fd 100644 --- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php +++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php @@ -604,7 +604,7 @@ protected function getDefaultPattern() if (self::NONE !== $this->timetype) { $patternParts[] = $this->defaultTimeFormats[$this->timetype]; } - $pattern = implode(' ', $patternParts); + $pattern = implode(', ', $patternParts); return $pattern; } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php index 4e7b0160fb3ad..b499eae850858 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php @@ -30,6 +30,21 @@ public function testConstructorWithUnsupportedLocale() new IntlDateFormatter('pt_BR', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); } + public function testEqualWithNative() + { + $native = \IntlDateFormatter::create('en', \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT); + + if ($native instanceof IntlDateFormatter) { + $this->markTestSkipped('No intl extension installed'); + } + + $replacement = IntlDateFormatter::create('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); + + $time = time(); + + $this->assertSame($native->format($time), $replacement->format($time)); + } + public function testStaticCreate() { $formatter = IntlDateFormatter::create('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);