Browse Source

Fix tests that were failing becuase of ICU changes.

Mark Story 7 years ago
parent
commit
853b691a52
1 changed files with 8 additions and 6 deletions
  1. 8 6
      tests/TestCase/I18n/NumberTest.php

+ 8 - 6
tests/TestCase/I18n/NumberTest.php

@@ -219,18 +219,20 @@ class NumberTest extends TestCase
 
         $options = ['locale' => 'fr_FR', 'pattern' => 'EUR #,###.00'];
         $result = $this->Number->currency($value, 'EUR', $options);
-        $expected = 'EUR 100 100 100,00';
-        $this->assertEquals($expected, $result);
+        // The following tests use regexp because whitespace used
+        // is inconsistent between *nix & windows.
+        $expected = '/^EUR\W+100\W+100\W+100,00$/';
+        $this->assertRegExp($expected, $result);
 
         $options = ['locale' => 'fr_FR', 'pattern' => '#,###.00 ¤¤'];
         $result = $this->Number->currency($value, 'EUR', $options);
-        $expected = '100 100 100,00 EUR';
-        $this->assertEquals($expected, $result);
+        $expected = '/^100\W+100\W+100,00\W+EUR$/';
+        $this->assertRegExp($expected, $result);
 
         $options = ['locale' => 'fr_FR', 'pattern' => '#,###.00;(¤#,###.00)'];
         $result = $this->Number->currency(-1235.03, 'EUR', $options);
-        $expected = '(€1 235,03)';
-        $this->assertEquals($expected, $result);
+        $expected = '/^\(€1\W+235,03\)$/';
+        $this->assertRegExp($expected, $result);
 
         $result = $this->Number->currency(0.5, 'USD', ['locale' => 'en_US', 'fractionSymbol' => 'c']);
         $expected = '50c';