summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-11-20 11:17:42 +0100
committerAnatol Belski <ab@php.net>2014-11-20 11:17:42 +0100
commitf97fc096a311a8a9a89aed33320a9a6fa1f5036d (patch)
tree0bc210c29fb0571ff6eae91df236f37ace6a6c05 /ext/intl
parentd438bcf2266ee1ddc56901fab65e022573874594 (diff)
downloadphp-git-f97fc096a311a8a9a89aed33320a9a6fa1f5036d.tar.gz
split ext/intl/tests/collator_create3.phpt for icu >= 54.1
Diffstat (limited to 'ext/intl')
-rw-r--r--ext/intl/tests/collator_create3.phpt3
-rw-r--r--ext/intl/tests/collator_create4.phpt79
2 files changed, 81 insertions, 1 deletions
diff --git a/ext/intl/tests/collator_create3.phpt b/ext/intl/tests/collator_create3.phpt
index c602e794cd..5041e635fa 100644
--- a/ext/intl/tests/collator_create3.phpt
+++ b/ext/intl/tests/collator_create3.phpt
@@ -1,8 +1,9 @@
--TEST--
-create() icu >= 53.1
+create() icu >= 53.1 && icu < 54.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
+<?php if (version_compare(INTL_ICU_VERSION, '54.1') >= 0) die('skip for ICU < 54.1'); ?>
--FILE--
<?php
diff --git a/ext/intl/tests/collator_create4.phpt b/ext/intl/tests/collator_create4.phpt
new file mode 100644
index 0000000000..2c22e6a442
--- /dev/null
+++ b/ext/intl/tests/collator_create4.phpt
@@ -0,0 +1,79 @@
+--TEST--
+create() icu >= 53.1
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if (version_compare(INTL_ICU_VERSION, '54.1') < 0) die('skip for ICU >= 54.1'); ?>
+--FILE--
+<?php
+
+/*
+ * Try creating collator with different locales
+ * with Procedural and Object methods.
+ */
+
+function ut_main()
+{
+ $res_str = '';
+
+ $locales = array(
+ 'EN-US-ODESSA',
+ 'UK_UA_ODESSA',
+ 'uk-ua_CALIFORNIA@currency=;currency=GRN',
+ '',
+ 'root',
+ 'uk@currency=EURO',
+ '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
+ );
+
+ foreach( $locales as $locale )
+ {
+ // Create Collator with the current locale.
+ $coll = ut_coll_create( $locale );
+ if( !is_object($coll) )
+ {
+ $res_str .= "Error creating collator with '$locale' locale: " .
+ intl_get_error_message() . "\n";
+ continue;
+ }
+
+ // Get the requested, valid and actual locales.
+ $vloc = ut_coll_get_locale( $coll, Locale::VALID_LOCALE );
+ $aloc = ut_coll_get_locale( $coll, Locale::ACTUAL_LOCALE );
+
+ // Show them.
+ $res_str .= "Locale: '$locale'\n" .
+ " ULOC_REQUESTED_LOCALE = '$locale'\n" .
+ " ULOC_VALID_LOCALE = '$vloc'\n" .
+ " ULOC_ACTUAL_LOCALE = '$aloc'\n";
+ }
+
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECTF--
+Locale: 'EN-US-ODESSA'
+ ULOC_REQUESTED_LOCALE = 'EN-US-ODESSA'
+ ULOC_VALID_LOCALE = 'en_US'
+ ULOC_ACTUAL_LOCALE = 'root'
+Locale: 'UK_UA_ODESSA'
+ ULOC_REQUESTED_LOCALE = 'UK_UA_ODESSA'
+ ULOC_VALID_LOCALE = 'uk'
+ ULOC_ACTUAL_LOCALE = 'uk'
+Error creating collator with 'uk-ua_CALIFORNIA@currency=;currency=GRN' locale: collator_create: unable to open ICU collator: U_ILLEGAL_ARGUMENT_ERROR
+Locale: ''
+ ULOC_REQUESTED_LOCALE = ''
+ ULOC_VALID_LOCALE = '%s'
+ ULOC_ACTUAL_LOCALE = '%s'
+Locale: 'root'
+ ULOC_REQUESTED_LOCALE = 'root'
+ ULOC_VALID_LOCALE = 'root'
+ ULOC_ACTUAL_LOCALE = 'root'
+Locale: 'uk@currency=EURO'
+ ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
+ ULOC_VALID_LOCALE = 'uk'
+ ULOC_ACTUAL_LOCALE = 'uk'
+Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR