Skip to content

Commit c42e6d6

Browse files
authored
ext/intl: modernize tests (#19392)
This is effectively removing ZPP tests, enabling warnings, and moving INI settings into the INI PHPT block
1 parent 3fc0149 commit c42e6d6

File tree

222 files changed

+424
-1621
lines changed

Some content is hidden

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

222 files changed

+424
-1621
lines changed

ext/intl/tests/breakiter___construct.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ IntlBreakIterator::__construct() should not be callable
44
intl
55
--FILE--
66
<?php
7-
ini_set("intl.error_level", E_WARNING);
87

9-
new IntlBreakIterator();
8+
try {
9+
new IntlBreakIterator();
10+
} catch (Throwable $e) {
11+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
12+
}
1013
?>
11-
--EXPECTF--
12-
Fatal error: Uncaught Error: Call to private IntlBreakIterator::__construct() from global scope in %s:%d
13-
Stack trace:
14-
#0 {main}
15-
thrown in %s on line %d
14+
--EXPECT--
15+
Error: Call to private IntlBreakIterator::__construct() from global scope

ext/intl/tests/breakiter___construct_error.phpt

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,44 @@ intl
55
--FILE--
66
<?php
77

8-
function print_exception($e) {
9-
echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
10-
}
11-
128
//missing ; at the end:
139
try {
1410
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
15-
} catch (IntlException $e) {
16-
print_exception($e);
11+
} catch (Throwable $e) {
12+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1713
}
1814
try {
1915
var_dump(new IntlRuleBasedBreakIterator());
20-
} catch (TypeError $e) {
21-
print_exception($e);
16+
} catch (Throwable $e) {
17+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
2218
}
2319
try {
2420
var_dump(new IntlRuleBasedBreakIterator(1,2,3));
25-
} catch (TypeError $e) {
26-
print_exception($e);
21+
} catch (Throwable $e) {
22+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
2723
}
2824
try {
2925
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
30-
} catch (TypeError $e) {
31-
print_exception($e);
26+
} catch (Throwable $e) {
27+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
3228
}
3329
try {
3430
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
35-
} catch (IntlException $e) {
36-
print_exception($e);
31+
} catch (Throwable $e) {
32+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
3733
}
3834

3935
$rbbi = new IntlRuleBasedBreakIterator(".;");
4036
try {
4137
$rbbi->__construct(".;");
42-
} catch (Error $e) {
43-
print_exception($e);
38+
} catch (Throwable $e) {
39+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
4440
}
4541
?>
46-
--EXPECTF--
47-
Exception: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d
48-
49-
Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given in %s on line %d
50-
51-
Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given in %s on line %d
52-
53-
Exception: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given in %s on line %d
54-
55-
Exception: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules in %s on line %d
56-
57-
Exception: IntlRuleBasedBreakIterator object is already constructed in %s on line %d
42+
--EXPECT--
43+
IntlException: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31)
44+
ArgumentCountError: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given
45+
ArgumentCountError: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given
46+
TypeError: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given
47+
IntlException: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules
48+
Error: IntlRuleBasedBreakIterator object is already constructed

ext/intl/tests/breakiter_clone_basic.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ IntlBreakIterator: clone handler
44
intl
55
--FILE--
66
<?php
7-
ini_set("intl.error_level", E_WARNING);
87

98
$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
109
$bi_clone = clone $bi;

ext/intl/tests/breakiter_createCodePointInstance_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
IntlBreakIterator::createCodePointInstance(): basic test
33
--EXTENSIONS--
44
intl
5+
--INI--
6+
intl.default_locale=pt_PT
57
--FILE--
68
<?php
7-
ini_set("intl.error_level", E_WARNING);
8-
ini_set("intl.default_locale", "pt_PT");
99

1010
$text = 'ตัวอย่างข้อความ';
1111

ext/intl/tests/breakiter_current_basic.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ IntlBreakIterator::current(): basic test
44
intl
55
--FILE--
66
<?php
7-
ini_set("intl.error_level", E_WARNING);
8-
ini_set("intl.default_locale", "pt_PT");
97

108
$bi = IntlBreakIterator::createWordInstance('pt');
119
var_dump($bi->current());

ext/intl/tests/breakiter_factories_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
IntlBreakIterator factories: basic tests
33
--EXTENSIONS--
44
intl
5+
--INI--
6+
intl.default_locale=ja
57
--FILE--
68
<?php
7-
ini_set("intl.error_level", E_WARNING);
8-
ini_set("intl.default_locale", "ja");
99

1010
$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
1111
'createSentenceInstance', 'createTitleInstance');

ext/intl/tests/breakiter_first_basic.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ IntlBreakIterator::first(): basic test
44
intl
55
--FILE--
66
<?php
7-
ini_set("intl.error_level", E_WARNING);
87

98
$bi = IntlBreakIterator::createWordInstance('pt');
109
$bi->setText('foo bar trans');

ext/intl/tests/breakiter_following_basic.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ IntlBreakIterator::following(): basic test
44
intl
55
--FILE--
66
<?php
7-
ini_set("intl.error_level", E_WARNING);
8-
ini_set("intl.default_locale", "pt_PT");
97

108
$bi = IntlBreakIterator::createWordInstance('pt');
119
$bi->setText('foo bar trans zoo bee');

ext/intl/tests/breakiter_getLocale_basic2.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ intl
66
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
77
--FILE--
88
<?php
9-
ini_set("intl.error_level", E_WARNING);
10-
ini_set("intl.default_locale", "pt_PT");
119

1210
$bi = IntlBreakIterator::createSentenceInstance('pt');
1311

ext/intl/tests/breakiter_getLocale_basic3.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ intl
66
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
77
--FILE--
88
<?php
9-
ini_set("intl.error_level", E_WARNING);
10-
ini_set("intl.default_locale", "pt_PT");
119

1210
$bi = IntlBreakIterator::createSentenceInstance('pt');
1311

0 commit comments

Comments
 (0)