com php-src: fix test for ICU-56.1: ext/intl/tests/collator_g et_sort_key_variant4.phpt ext/intl/tests/collator _get_sort_key_variant5.phpt
ext/intl/tests/collat or_get_sort_key_variant6.phpt

From: Date: Mon, 12 Oct 2015 09:10:04 +0000
Subject: com php-src: fix test for ICU-56.1: ext/intl/tests/collator_g et_sort_key_variant4.phpt ext/intl/tests/collator _get_sort_key_variant5.phpt
ext/intl/tests/collat or_get_sort_key_variant6.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89369@lists.php.net to get a copy of this message
Commit: 3fb6f0014a6512162836f8579b45fee6fbcb902d Author: Anatol Belski <ab@php.net> Mon, 12 Oct 2015 11:10:04 +0200 Parents: 474a2e01eb8b8a8051a577029f5ac4e4a5617564 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3fb6f0014a6512162836f8579b45fee6fbcb902d Log: fix test for ICU-56.1 Changed paths: M ext/intl/tests/collator_get_sort_key_variant4.phpt M ext/intl/tests/collator_get_sort_key_variant5.phpt A ext/intl/tests/collator_get_sort_key_variant6.phpt Diff: diff --git a/ext/intl/tests/collator_get_sort_key_variant4.phpt b/ext/intl/tests/collator_get_sort_key_variant4.phpt index ed2c9bc..bd7af6a 100644 --- a/ext/intl/tests/collator_get_sort_key_variant4.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant4.phpt @@ -1,5 +1,5 @@ --TEST-- -collator_get_sort_key() icu >= 55.1 +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'); ?> diff --git a/ext/intl/tests/collator_get_sort_key_variant5.phpt b/ext/intl/tests/collator_get_sort_key_variant5.phpt index 52a3af9..c771738 100644 --- a/ext/intl/tests/collator_get_sort_key_variant5.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant5.phpt @@ -2,6 +2,7 @@ collator_get_sort_key() icu >= 55.1 --SKIPIF-- <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +<?php if (version_compare(INTL_ICU_VERSION, '56.1') >= 0) die('skip for ICU < 56.1'); ?> <?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?> --FILE-- <?php diff --git a/ext/intl/tests/collator_get_sort_key_variant6.phpt b/ext/intl/tests/collator_get_sort_key_variant6.phpt new file mode 100644 index 0000000..d8105d7 --- /dev/null +++ b/ext/intl/tests/collator_get_sort_key_variant6.phpt @@ -0,0 +1,98 @@ +--TEST-- +collator_get_sort_key() icu >= 56.1 +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +<?php if (version_compare(INTL_ICU_VERSION, '56.1') < 0) die('skip for ICU >= 56.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: 262c2c2c01070107 +source: эюя +key: 26eef0f401070107 +source: абг +key: 60060c1001070107 +source: абв +key: 60060c0e01070107 +source: жжж +key: 602c2c2c01070107 +source: эюя +key: 60eef0f401070107

« previous php.cvs (#89369) next »