Skip to content

Commit 9ec9344

Browse files
committed
MFB: fixed tests. money_format() is implemented in underlying system, not in php. So, we shouldn't test for actual values returned. They are different between systems
1 parent c9b0466 commit 9ec9344

File tree

6 files changed

+84
-265
lines changed

6 files changed

+84
-265
lines changed

ext/standard/tests/strings/money_format_basic1.phpt

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
Test money_format() function : basic functionality using national currency symbols
33
--SKIPIF--
44
<?php
5-
if (!function_exists('money_format') || !function_exists('setlocale')) {
5+
if (!function_exists('money_format')) {
66
die("SKIP money_format - not supported\n");
77
}
8-
9-
if (setlocale(LC_MONETARY, 'en_US') == false) {
10-
die("SKIP en_US locale not available\n");
11-
}
128
?>
139
--FILE--
1410
<?php
@@ -17,9 +13,11 @@ Test money_format() function : basic functionality using national currency symbo
1713
* Source code: ext/standard/string.c
1814
*/
1915

20-
echo "*** Testing money_format() : basic functionality using national currency symbols***\n";
16+
// ===========================================================================================
17+
// = We do not test for exact return-values, as those might be different between OS-versions =
18+
// ===========================================================================================
2119

22-
$original = setlocale(LC_MONETARY, 'en_US');
20+
echo "*** Testing money_format() : basic functionality***\n";
2321

2422
$value = 1234.5678;
2523
$negative_value = -1234.5678;
@@ -28,57 +26,55 @@ $negative_value = -1234.5678;
2826
// left precision, 2 of right precision using national
2927
// format for en_US
3028
echo "Format values with 14 positions, 8 digits to left, 2 to right using national format\n";
31-
var_dump( money_format('%14#8.2n', $value));
32-
var_dump( money_format('%14#8.2n', $negative_value));
29+
echo gettype(money_format('%14#8.2n', $value))."\n";
30+
echo gettype(money_format('%14#8.2n', $negative_value))."\n";
3331

3432
// Same again but use '(' for negative values
3533
echo "Format again but with ( for negative values\n";
36-
var_dump( money_format('%(14#8.2n', $value));
37-
var_dump( money_format('%(14#8.2n', $negative_value));
34+
echo gettype(money_format('%(14#8.2n', $value))."\n";
35+
echo gettype(money_format('%(14#8.2n', $negative_value))."\n";
3836

3937
// Same again but use a '0' for padding character
4038
echo "Format with 0 for padding character\n";
41-
var_dump( money_format('%=014#8.2n', $value));
42-
var_dump( money_format('%=014#8.2n', $negative_value));
39+
echo gettype(money_format('%=014#8.2n', $value))."\n";
40+
echo gettype(money_format('%=014#8.2n', $negative_value))."\n";
4341

4442
// Same again but use a '*' for padding character
4543
echo "Format again with * for padding character\n";
46-
var_dump( money_format('%=*14#8.2n', $value));
47-
var_dump( money_format('%=*14#8.2n', $negative_value));
44+
echo gettype(money_format('%=*14#8.2n', $value))."\n";
45+
echo gettype(money_format('%=*14#8.2n', $negative_value))."\n";
4846

4947
// Same again but disable grouping character
5048
echo "Format again but disable grouping character\n";
51-
var_dump( money_format('%=*^14#8.2n', $value));
52-
var_dump( money_format('%=*^14#8.2n', $negative_value));
49+
echo gettype(money_format('%=*^14#8.2n', $value))."\n";
50+
echo gettype(money_format('%=*^14#8.2n', $negative_value))."\n";
5351

5452
// Same again but suppress currency symbol
5553
echo "Format again suppress currency symbol\n";
56-
var_dump( money_format('%=*!14#8.2n', $value));
57-
var_dump( money_format('%=*!14#8.2n', $negative_value));
58-
59-
setlocale(LC_MONETARY, $original);
54+
echo gettype(money_format('%=*!14#8.2n', $value))."\n";
55+
echo gettype(money_format('%=*!14#8.2n', $negative_value))."\n";
6056

6157
?>
6258
===DONE===
6359
--EXPECT--
64-
*** Testing money_format() : basic functionality using national currency symbols***
60+
*** Testing money_format() : basic functionality***
6561
Format values with 14 positions, 8 digits to left, 2 to right using national format
66-
string(15) " $ 1,234.57"
67-
string(15) "-$ 1,234.57"
62+
string
63+
string
6864
Format again but with ( for negative values
69-
string(15) " $ 1,234.57"
70-
string(16) "($ 1,234.57)"
65+
string
66+
string
7167
Format with 0 for padding character
72-
string(15) " $000001,234.57"
73-
string(15) "-$000001,234.57"
68+
string
69+
string
7470
Format again with * for padding character
75-
string(15) " $*****1,234.57"
76-
string(15) "-$*****1,234.57"
71+
string
72+
string
7773
Format again but disable grouping character
78-
string(14) " $****1234.57"
79-
string(14) " -$****1234.57"
74+
string
75+
string
8076
Format again suppress currency symbol
81-
string(14) " *****1,234.57"
82-
string(14) "-*****1,234.57"
77+
string
78+
string
8379
===DONE===
8480

ext/standard/tests/strings/money_format_basic2.phpt

Lines changed: 0 additions & 84 deletions
This file was deleted.

ext/standard/tests/strings/money_format_basic3.phpt

Lines changed: 0 additions & 83 deletions
This file was deleted.

ext/standard/tests/strings/money_format_error.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Test money_format() function : error conditions
1313
* Source code: ext/standard/string.c
1414
*/
1515

16+
// ===========================================================================================
17+
// = We do not test for exact return-values, as those might be different between OS-versions =
18+
// ===========================================================================================
19+
1620
$string = '%14#8.2n';
1721
$value = 1234.56;
1822
$extra_arg = 10;

0 commit comments

Comments
 (0)