Skip to content

Commit 6822147

Browse files
committed
[Intl] Update tests and the number formatter to match behaviour of the intl extension
1 parent 37a9d8c commit 6822147

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Symfony/Component/Intl/Intl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public static function getIcuDataVersion()
234234
*/
235235
public static function getIcuStubVersion()
236236
{
237-
return '51.2';
237+
return '55.1';
238238
}
239239

240240
/**

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class NumberFormatter
239239

240240
private static $enTextAttributes = array(
241241
self::DECIMAL => array('', '', '-', '', '*', '', ''),
242-
self::CURRENCY => array('¤', '', '(¤', ')', '*', ''),
242+
self::CURRENCY => array('¤', '', '-¤', '', '*', ''),
243243
);
244244

245245
/**
@@ -337,7 +337,7 @@ public function formatCurrency($value, $currency)
337337

338338
$ret = $symbol.$value;
339339

340-
return $negative ? '('.$ret.')' : $ret;
340+
return $negative ? '-'.$ret : $ret;
341341
}
342342

343343
/**

src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ public function formatCurrencyWithCurrencyStyleProvider()
6464
{
6565
return array(
6666
array(100, 'ALL', 'ALL100'),
67-
array(-100, 'ALL', '(ALL100)'),
67+
array(-100, 'ALL', '-ALL100'),
6868
array(1000.12, 'ALL', 'ALL1,000'),
6969

7070
array(100, 'JPY', '¥100'),
71-
array(-100, 'JPY', '(¥100)'),
71+
array(-100, 'JPY', '-¥100'),
7272
array(1000.12, 'JPY', '¥1,000'),
7373

7474
array(100, 'EUR', '€100.00'),
75-
array(-100, 'EUR', '(€100.00)'),
75+
array(-100, 'EUR', '-€100.00'),
7676
array(1000.12, 'EUR', '€1,000.12'),
7777
);
7878
}
@@ -90,7 +90,7 @@ public function formatCurrencyWithCurrencyStyleCostaRicanColonsRoundingProvider(
9090
{
9191
return array(
9292
array(100, 'CRC', 'CRC', '%s100'),
93-
array(-100, 'CRC', 'CRC', '(%s100)'),
93+
array(-100, 'CRC', 'CRC', '-%s100'),
9494
array(1000.12, 'CRC', 'CRC', '%s1,000'),
9595
);
9696
}
@@ -108,7 +108,7 @@ public function formatCurrencyWithCurrencyStyleBrazilianRealRoundingProvider()
108108
{
109109
return array(
110110
array(100, 'BRL', 'R', '%s$100.00'),
111-
array(-100, 'BRL', 'R', '(%s$100.00)'),
111+
array(-100, 'BRL', 'R', '-%s$100.00'),
112112
array(1000.12, 'BRL', 'R', '%s$1,000.12'),
113113

114114
// Rounding checks
@@ -135,7 +135,7 @@ public function formatCurrencyWithCurrencyStyleSwissRoundingProvider()
135135
{
136136
return array(
137137
array(100, 'CHF', 'CHF', '%s100.00'),
138-
array(-100, 'CHF', 'CHF', '(%s100.00)'),
138+
array(-100, 'CHF', 'CHF', '-%s100.00'),
139139
array(1000.12, 'CHF', 'CHF', '%s1,000.12'),
140140
array('1000.12', 'CHF', 'CHF', '%s1,000.12'),
141141

@@ -216,7 +216,7 @@ public function formatTypeInt32WithCurrencyStyleProvider()
216216
return array(
217217
array($formatter, 1, '¤1.00'),
218218
array($formatter, 1.1, '¤1.00'),
219-
array($formatter, 2147483648, '(¤2,147,483,648.00)', $message),
219+
array($formatter, 2147483648, '-¤2,147,483,648.00', $message),
220220
array($formatter, -2147483649, '¤2,147,483,647.00', $message),
221221
);
222222
}
@@ -261,7 +261,7 @@ public function formatTypeInt64WithCurrencyStyleProvider()
261261
array($formatter, 1, '¤1.00'),
262262
array($formatter, 1.1, '¤1.00'),
263263
array($formatter, 2147483648, '¤2,147,483,648.00'),
264-
array($formatter, -2147483649, '(¤2,147,483,649.00)'),
264+
array($formatter, -2147483649, '-¤2,147,483,649.00'),
265265
);
266266
}
267267

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy