forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mtraver/intl-tests
Apply commits from php/php-src that update tests for newer ICU versions
- Loading branch information
Showing
76 changed files
with
1,218 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
IntlBreakIterator::getLocale(): basic test | ||
--SKIPIF-- | ||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> | ||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?> | ||
--FILE-- | ||
<?php | ||
ini_set("intl.error_level", E_WARNING); | ||
ini_set("intl.default_locale", "pt_PT"); | ||
|
||
$bi = IntlBreakIterator::createSentenceInstance('pt'); | ||
|
||
var_dump($bi->getLocale(0)); | ||
var_dump($bi->getLocale(1)); | ||
?> | ||
==DONE== | ||
--EXPECT-- | ||
string(4) "root" | ||
string(2) "pt" | ||
==DONE== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--TEST-- | ||
Bug #62070: Collator::getSortKey() returns garbage | ||
--SKIPIF-- | ||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> | ||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?> | ||
--FILE-- | ||
<?php | ||
$s1 = 'Hello'; | ||
|
||
$coll = collator_create('en_US'); | ||
$res = collator_get_sort_key($coll, $s1); | ||
|
||
echo urlencode($res); | ||
--EXPECT-- | ||
82%40%40F%01%09%01%DC%08 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--TEST-- | ||
IntlCalendar::getDayOfWeekType() basic test | ||
--INI-- | ||
date.timezone=Atlantic/Azores | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('intl')) | ||
die('skip intl extension not enabled'); | ||
if (version_compare(INTL_ICU_VERSION, '52.1') < 0) | ||
die('skip for ICU >= 52.1'); | ||
--FILE-- | ||
<?php | ||
ini_set("intl.error_level", E_WARNING); | ||
ini_set("intl.default_locale", "nl"); | ||
|
||
$intlcal = IntlCalendar::createInstance('UTC'); | ||
$intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000); | ||
var_dump( | ||
intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), | ||
$intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), | ||
$intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), | ||
$intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), | ||
$intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) | ||
); | ||
|
||
?> | ||
==DONE== | ||
--EXPECT-- | ||
int(1) | ||
int(0) | ||
int(0) | ||
int(0) | ||
int(1) | ||
==DONE== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--TEST-- | ||
collator_get_sort_key() icu >= 54.1 | ||
--SKIPIF-- | ||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> | ||
<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
/* | ||
* Get sort keys using various locales | ||
*/ | ||
function sort_arrays( $locale, $data ) | ||
{ | ||
$res_str = ''; | ||
|
||
$coll = ut_coll_create( $locale ); | ||
|
||
foreach($data as $value) { | ||
$res_val = ut_coll_get_sort_key( $coll, $value ); | ||
$res_str .= "source: ".$value."\n". | ||
"key: ".bin2hex($res_val)."\n"; | ||
} | ||
|
||
return $res_str; | ||
} | ||
|
||
|
||
function ut_main() | ||
{ | ||
$res_str = ''; | ||
|
||
// Regular strings keys | ||
$test_params = array( | ||
'abc', 'abd', 'aaa', | ||
'аа', 'а', 'z', | ||
'', null , '3', | ||
'y' , 'i' , 'k' | ||
); | ||
|
||
$res_str .= sort_arrays( 'en_US', $test_params ); | ||
|
||
// Sort a non-ASCII array using ru_RU locale. | ||
$test_params = array( | ||
'абг', 'абв', 'жжж', 'эюя' | ||
); | ||
|
||
$res_str .= sort_arrays( 'ru_RU', $test_params ); | ||
|
||
// Sort an array using Lithuanian locale. | ||
$res_str .= sort_arrays( 'lt_LT', $test_params ); | ||
|
||
return $res_str . "\n"; | ||
} | ||
|
||
include_once( 'ut_common.inc' ); | ||
ut_run(); | ||
?> | ||
--EXPECT-- | ||
source: abc | ||
key: 292b2d01070107 | ||
source: abd | ||
key: 292b2f01070107 | ||
source: aaa | ||
key: 29292901070107 | ||
source: аа | ||
key: 60060601060106 | ||
source: а | ||
key: 600601050105 | ||
source: z | ||
key: 5b01050105 | ||
source: | ||
key: 0101 | ||
source: | ||
key: 0101 | ||
source: 3 | ||
key: 1801050105 | ||
source: y | ||
key: 5901050105 | ||
source: i | ||
key: 3901050105 | ||
source: k | ||
key: 3d01050105 | ||
source: абг | ||
key: 26060c1001070107 | ||
source: абв | ||
key: 26060c0e01070107 | ||
source: жжж | ||
key: 2626262601070107 | ||
source: эюя | ||
key: 26b4b6ba01070107 | ||
source: абг | ||
key: 60060c1001070107 | ||
source: абв | ||
key: 60060c0e01070107 | ||
source: жжж | ||
key: 6026262601070107 | ||
source: эюя | ||
key: 60b4b6ba01070107 |
Oops, something went wrong.