Skip to content

Commit

Permalink
Fix tests that were failing becuase of ICU changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 14, 2018
1 parent b17e866 commit 853b691
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/TestCase/I18n/NumberTest.php
Expand Up @@ -219,18 +219,20 @@ public function testCurrency()


$options = ['locale' => 'fr_FR', 'pattern' => 'EUR #,###.00']; $options = ['locale' => 'fr_FR', 'pattern' => 'EUR #,###.00'];
$result = $this->Number->currency($value, 'EUR', $options); $result = $this->Number->currency($value, 'EUR', $options);
$expected = 'EUR 100 100 100,00'; // The following tests use regexp because whitespace used
$this->assertEquals($expected, $result); // is inconsistent between *nix & windows.
$expected = '/^EUR\W+100\W+100\W+100,00$/';
$this->assertRegExp($expected, $result);


$options = ['locale' => 'fr_FR', 'pattern' => '#,###.00 ¤¤']; $options = ['locale' => 'fr_FR', 'pattern' => '#,###.00 ¤¤'];
$result = $this->Number->currency($value, 'EUR', $options); $result = $this->Number->currency($value, 'EUR', $options);
$expected = '100 100 100,00 EUR'; $expected = '/^100\W+100\W+100,00\W+EUR$/';
$this->assertEquals($expected, $result); $this->assertRegExp($expected, $result);


$options = ['locale' => 'fr_FR', 'pattern' => '#,###.00;(¤#,###.00)']; $options = ['locale' => 'fr_FR', 'pattern' => '#,###.00;(¤#,###.00)'];
$result = $this->Number->currency(-1235.03, 'EUR', $options); $result = $this->Number->currency(-1235.03, 'EUR', $options);
$expected = '(€1 235,03)'; $expected = '/^\(€1\W+235,03\)$/';
$this->assertEquals($expected, $result); $this->assertRegExp($expected, $result);


$result = $this->Number->currency(0.5, 'USD', ['locale' => 'en_US', 'fractionSymbol' => 'c']); $result = $this->Number->currency(0.5, 'USD', ['locale' => 'en_US', 'fractionSymbol' => 'c']);
$expected = '50c'; $expected = '50c';
Expand Down

0 comments on commit 853b691

Please sign in to comment.