ソースを参照

catch MessageFormatter specific exception message test for PHP7

ref https://wiki.php.net/rfc/internal_constructor_behaviour
antograssiot 10 年 前
コミット
295ce50882
1 ファイル変更15 行追加0 行削除
  1. 15 0
      tests/TestCase/I18n/Formatter/IcuFormatterTest.php

+ 15 - 0
tests/TestCase/I18n/Formatter/IcuFormatterTest.php

@@ -101,6 +101,21 @@ class IcuFormatterTest extends TestCase
      */
     public function testBadMessageFormat()
     {
+        $this->skipIf(version_compare(PHP_VERSION, '7', '>='), 'Skiped for PHP 7 as MessageFormatter throws a different exception');
+        $formatter = new IcuFormatter();
+        $formatter->format('en_US', '{crazy format', ['some', 'vars']);
+    }
+
+    /**
+     * Tests that passing a message in the wrong format will throw an exception
+     *
+     * @expectedException Exception
+     * @expectedExceptionMessage Constructor failed
+     * @return void
+     */
+    public function testBadMessageFormatPHP7()
+    {
+        $this->skipIf(version_compare(PHP_VERSION, '7', '<'), 'Skiped for PHP 5.x as MessageFormatter throws a different exception');
         $formatter = new IcuFormatter();
         $formatter->format('en_US', '{crazy format', ['some', 'vars']);
     }