Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ext/intl/tests/breakiter___construct.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ IntlBreakIterator::__construct() should not be callable
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

new IntlBreakIterator();
try {
new IntlBreakIterator();
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Call to private IntlBreakIterator::__construct() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
--EXPECT--
Error: Call to private IntlBreakIterator::__construct() from global scope
47 changes: 19 additions & 28 deletions ext/intl/tests/breakiter___construct_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,44 @@ intl
--FILE--
<?php

function print_exception($e) {
echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
}

//missing ; at the end:
try {
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
} catch (IntlException $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator());
} catch (TypeError $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator(1,2,3));
} catch (TypeError $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
} catch (TypeError $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
} catch (IntlException $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

$rbbi = new IntlRuleBasedBreakIterator(".;");
try {
$rbbi->__construct(".;");
} catch (Error $e) {
print_exception($e);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Exception: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d

Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given in %s on line %d

Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given in %s on line %d

Exception: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given in %s on line %d

Exception: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules in %s on line %d

Exception: IntlRuleBasedBreakIterator object is already constructed in %s on line %d
--EXPECT--
IntlException: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31)
ArgumentCountError: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given
ArgumentCountError: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given
TypeError: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given
IntlException: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules
Error: IntlRuleBasedBreakIterator object is already constructed
1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_clone_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IntlBreakIterator: clone handler
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
$bi_clone = clone $bi;
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/tests/breakiter_createCodePointInstance_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
IntlBreakIterator::createCodePointInstance(): basic test
--EXTENSIONS--
intl
--INI--
intl.default_locale=pt_PT
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

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

Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_current_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ IntlBreakIterator::current(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
var_dump($bi->current());
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/tests/breakiter_factories_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
IntlBreakIterator factories: basic tests
--EXTENSIONS--
intl
--INI--
intl.default_locale=ja
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "ja");

$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
'createSentenceInstance', 'createTitleInstance');
Expand Down
1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_first_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IntlBreakIterator::first(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans');
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_following_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ IntlBreakIterator::following(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_getLocale_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ intl
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

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

Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_getLocale_basic3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ intl
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

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

Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_getPartsIterator_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') > 0) die('skip for ICU <= 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$pi = $bi->getPartsIterator();
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_getPartsIterator_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') <= 0) die('skip for ICU > 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$pi = $bi->getPartsIterator();
Expand Down
1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_getPartsIterator_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IntlBreakIterator::getPartsIterator(): bad args
intl
--FILE--
<?php
ini_set("intl.default_locale", "pt_PT");

$it = IntlBreakIterator::createWordInstance(NULL);

Expand Down
4 changes: 2 additions & 2 deletions ext/intl/tests/breakiter_getPartsIterator_var1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
IntlBreakIterator::getPartsIterator(): argument variations
--EXTENSIONS--
intl
--INI--
intl.default_locale=pt_PT
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$text = 'foo bar tao';

Expand Down
1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_getText_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IntlBreakIterator::getText(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

$bi = IntlBreakIterator::createWordInstance('pt');
var_dump($bi->getText());
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_isBoundary_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ IntlBreakIterator::isBoundary(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');
Expand Down
1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_last_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IntlBreakIterator::last(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans');
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_next_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ IntlBreakIterator::next(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_preceding_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') > 0) die('skip for ICU <= 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_preceding_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if (version_compare(INTL_ICU_VERSION, '57.1') <= 0) die('skip for ICU > 57.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans zoo bee');
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/breakiter_previous_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ IntlBreakIterator::previous(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");

$bi = IntlBreakIterator::createWordInstance('pt');
$bi->setText('foo bar trans');
Expand Down
1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_setText_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IntlBreakIterator::setText(): basic test
intl
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

class A {
function __tostring() { return 'aaa'; }
Expand Down
6 changes: 2 additions & 4 deletions ext/intl/tests/bug58756_MessageFormatter_variant2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Bug #58756: w.r.t MessageFormatter
--EXTENSIONS--
intl
--INI--
date.timezone=America/New_York
--SKIPIF--
<?php
if (str_contains(PHP_OS, 'FreeBSD')) {
Expand All @@ -10,13 +12,9 @@ if (str_contains(PHP_OS, 'FreeBSD')) {
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");

$time = 1247013673;

ini_set('date.timezone', 'America/New_York');

$msgf = new MessageFormatter('en_US', '{0,date,full} {0,time,h:m:s a V}');

echo "date: " . date('l, F j, Y g:i:s A T', $time) . "\n";
Expand Down
14 changes: 7 additions & 7 deletions ext/intl/tests/bug60192-compare.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class Collator2 extends Collator{
}

$c = new Collator2();
$a = $c->compare('h', 'H');
try {
$a = $c->compare('h', 'H');
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->compare('h', 'H')
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized
14 changes: 7 additions & 7 deletions ext/intl/tests/bug60192-getlocale.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Collator2 extends Collator{
}

$c = new Collator2();
$c->getLocale(Locale::ACTUAL_LOCALE);
try {
$c->getLocale(Locale::ACTUAL_LOCALE);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->getLocale(0)
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized
14 changes: 7 additions & 7 deletions ext/intl/tests/bug60192-getsortkey.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Collator2 extends Collator{
}

$c = new Collator2();
$c->getSortKey('h');
try {
$c->getSortKey('h');
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->getSortKey('h')
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized
14 changes: 7 additions & 7 deletions ext/intl/tests/bug60192-sort.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class Collator2 extends Collator{

$c = new Collator2();
$a = array('a', 'b');
$c->sort($a);
try {
$c->sort($a);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->sort(Array)
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized
14 changes: 7 additions & 7 deletions ext/intl/tests/bug60192-sortwithsortkeys.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class Collator2 extends Collator{

$c = new Collator2();
$a = array('a', 'b');
$c->sortWithSortKeys($a);
try {
$c->sortWithSortKeys($a);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): Collator->sortWithSortKeys(Array)
#1 {main}
thrown in %s on line %d
--EXPECT--
Error: Object not initialized
Loading