Browse Source

[Locale] move intl bugs to skipped tests

Igor Wiedler 14 years ago
parent
commit
69f56dbbd9

+ 29 - 1
tests/Symfony/Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php

@@ -23,7 +23,6 @@ class StubIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
 
             /* escaping */
             array("'M", 0, 'M'),
-            array("'y-'M-'d", 0, 'y-M-d'),
             array("'yy", 0, 'yy'),
             array("'''yy", 0, "'yy"),
             array("''y", 0, "'1970"),
@@ -53,6 +52,19 @@ class StubIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
         );
     }
 
+    /**
+    * provides data for cases that are broken in icu/intl
+    */
+    public function brokenFormatProvider()
+    {
+        return array(
+            /* escaping */
+            array("'y-'M-'d", 0, 'y-M-d'),
+            array("WTF 'y-'M", 0, '0T1 y-M'),
+            array("n-'M", 0, 'n-M'),
+        );
+    }
+
     /**
      * @expectedException InvalidArgumentException
      */
@@ -81,6 +93,22 @@ class StubIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
         }
     }
 
+    /**
+    * @dataProvider brokenFormatProvider
+    */
+    public function testBrokenFormat($pattern, $timestamp, $expected)
+    {
+        $this->markTestSkipped('icu/intl has some bugs, thus skipping.');
+
+        $formatter = new StubIntlDateFormatter('en', StubIntlDateFormatter::MEDIUM, StubIntlDateFormatter::SHORT, 'UTC', StubIntlDateFormatter::GREGORIAN, $pattern);
+        $this->assertEquals($expected, $formatter->format($timestamp), 'Check date format with stub implementation.');
+
+        if (extension_loaded('intl')) {
+            $formatter = new \IntlDateFormatter('en', \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT, 'UTC', \IntlDateFormatter::GREGORIAN, $pattern);
+            $this->assertEquals($expected, $formatter->format($timestamp), 'Check date format with intl extension.');
+        }
+    }
+
     /**
      * @expectedException RuntimeException
      */