Skip to content

Commit 6afaaf8

Browse files
committed
ext/intl: applied fixers to improve test robustness
1 parent 179f176 commit 6afaaf8

99 files changed

Lines changed: 381 additions & 385 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ext/intl/tests/breakiter___construct.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ intl
88
try {
99
new IntlBreakIterator();
1010
} catch (Throwable $e) {
11-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
11+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1212
}
1313
?>
1414
--EXPECT--

ext/intl/tests/breakiter___construct_error.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ intl
99
try {
1010
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
1111
} catch (Throwable $e) {
12-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
12+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1313
}
1414
try {
1515
var_dump(new IntlRuleBasedBreakIterator());
1616
} catch (Throwable $e) {
17-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
17+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1818
}
1919
try {
2020
var_dump(new IntlRuleBasedBreakIterator(1,2,3));
2121
} catch (Throwable $e) {
22-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
22+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
2323
}
2424
try {
2525
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
2626
} catch (Throwable $e) {
27-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
27+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
2828
}
2929
try {
3030
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
3131
} catch (Throwable $e) {
32-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
32+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
3333
}
3434

3535
$rbbi = new IntlRuleBasedBreakIterator(".;");
3636
try {
3737
$rbbi->__construct(".;");
3838
} catch (Throwable $e) {
39-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
39+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
4040
}
4141
?>
4242
--EXPECT--

ext/intl/tests/breakiter_getPartsIterator_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ $it = IntlBreakIterator::createWordInstance(NULL);
1010
try {
1111
var_dump($it->getPartsIterator(-1));
1212
} catch(\ValueError $e) {
13-
echo $e->getMessage() . \PHP_EOL;
13+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1414
}
1515

1616
?>
1717
--EXPECT--
18-
IntlBreakIterator::getPartsIterator(): Argument #1 ($type) must be one of IntlPartsIterator::KEY_SEQUENTIAL, IntlPartsIterator::KEY_LEFT, or IntlPartsIterator::KEY_RIGHT
18+
ValueError: IntlBreakIterator::getPartsIterator(): Argument #1 ($type) must be one of IntlPartsIterator::KEY_SEQUENTIAL, IntlPartsIterator::KEY_LEFT, or IntlPartsIterator::KEY_RIGHT

ext/intl/tests/bug48227.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ foreach (['', 1, NULL, $x] as $value) {
1010
try {
1111
var_dump($x->format($value));
1212
} catch (TypeError $ex) {
13-
echo $ex->getMessage(), PHP_EOL;
13+
echo $ex::class, ': ', $ex->getMessage(), \PHP_EOL;
1414
}
1515
}
1616

1717
?>
1818
--EXPECTF--
19-
NumberFormatter::format(): Argument #1 ($num) must be of type int|float, string given
19+
TypeError: NumberFormatter::format(): Argument #1 ($num) must be of type int|float, string given
2020
string(1) "1"
2121

2222
Deprecated: NumberFormatter::format(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
2323
string(1) "0"
24-
NumberFormatter::format(): Argument #1 ($num) must be of type int|float, NumberFormatter given
24+
TypeError: NumberFormatter::format(): Argument #1 ($num) must be of type int|float, NumberFormatter given

ext/intl/tests/bug60192-compare.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $c = new Collator2();
1414
try {
1515
$a = $c->compare('h', 'H');
1616
} catch (Throwable $e) {
17-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
17+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1818
}
1919
?>
2020
--EXPECT--

ext/intl/tests/bug60192-getlocale.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $c = new Collator2();
1515
try {
1616
$c->getLocale(Locale::ACTUAL_LOCALE);
1717
} catch (Throwable $e) {
18-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
18+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1919
}
2020
?>
2121
--EXPECT--

ext/intl/tests/bug60192-getsortkey.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $c = new Collator2();
1515
try {
1616
$c->getSortKey('h');
1717
} catch (Throwable $e) {
18-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
18+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
1919
}
2020
?>
2121
--EXPECT--

ext/intl/tests/bug60192-sort.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $a = array('a', 'b');
1616
try {
1717
$c->sort($a);
1818
} catch (Throwable $e) {
19-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
19+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
2020
}
2121
?>
2222
--EXPECT--

ext/intl/tests/bug60192-sortwithsortkeys.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $a = array('a', 'b');
1616
try {
1717
$c->sortWithSortKeys($a);
1818
} catch (Throwable $e) {
19-
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
19+
echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
2020
}
2121
?>
2222
--EXPECT--

ext/intl/tests/bug61487.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ intl
1010
try {
1111
grapheme_stripos(1,1,2147483648);
1212
} catch (ValueError $exception) {
13-
echo $exception->getMessage() . "\n";
13+
echo $exception::class, ': ', $exception->getMessage(), \PHP_EOL;
1414
}
1515

1616
try {
1717
grapheme_strpos(1,1,2147483648);
1818
} catch (ValueError $exception) {
19-
echo $exception->getMessage() . "\n";
19+
echo $exception::class, ': ', $exception->getMessage(), \PHP_EOL;
2020
}
2121
?>
2222
--EXPECT--
23-
grapheme_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
24-
grapheme_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
23+
ValueError: grapheme_stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
24+
ValueError: grapheme_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)

0 commit comments

Comments
 (0)