diff options
-rw-r--r-- | ext/intl/tests/bug71020.phpt | 15 | ||||
-rw-r--r-- | ext/intl/tests/collator_get_sort_key_variant5.phpt | 99 | ||||
-rw-r--r-- | ext/intl/tests/collator_get_sort_key_variant6.phpt | 98 | ||||
-rw-r--r-- | ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt | 40 | ||||
-rw-r--r-- | ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt | 33 | ||||
-rw-r--r-- | ext/intl/tests/dateformat_get_set_timezone_variant5.phpt | 62 | ||||
-rw-r--r-- | ext/intl/tests/formatter_format6.phpt | 130 | ||||
-rw-r--r-- | ext/intl/tests/formatter_get_set_text_attribute_var2.phpt | 122 | ||||
-rw-r--r-- | ext/intl/tests/spoofchecker_005.phpt | 29 | ||||
-rw-r--r-- | ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt | 8 |
10 files changed, 636 insertions, 0 deletions
diff --git a/ext/intl/tests/bug71020.phpt b/ext/intl/tests/bug71020.phpt new file mode 100644 index 0000000000..368d967efd --- /dev/null +++ b/ext/intl/tests/bug71020.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #71020 (Use after free in Collator::sortWithSortKeys) +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + +$var_3=new Collator("Whatever"); +for($x=0;$x<0xbb;$x++) + $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x); +$var_3->sortWithSortKeys($myarray); +?> +okey +--EXPECT-- +okey diff --git a/ext/intl/tests/collator_get_sort_key_variant5.phpt b/ext/intl/tests/collator_get_sort_key_variant5.phpt new file mode 100644 index 0000000000..c7717389b7 --- /dev/null +++ b/ext/intl/tests/collator_get_sort_key_variant5.phpt @@ -0,0 +1,99 @@ +--TEST-- +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 + +/* + * 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 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 0000000000..d8105d76d4 --- /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 diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt new file mode 100644 index 0000000000..d68b1f5fcb --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt @@ -0,0 +1,40 @@ +--TEST-- +IntlDateFormatter::formatObject(): IntlCalendar tests +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?> +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); +ini_set("intl.default_locale", "pt_PT"); +ini_set("date.timezone", "Europe/Lisbon"); + +$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n"; +echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n"; +echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n"; +echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n"; + +$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00'); +echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n"; + +$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil'); +$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.); +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n"; + +?> +==DONE== + +--EXPECTF-- +01/01/2012, 00:00:00 +domingo, 1 de janeiro de 2012 às 00:00:00 Hora padrão %Sda Europa Ocidental +Jan 1, 2012, 12:00:00 AM +1/1/12, 12:00:00 AM Western European Standard %STime +Sun 2012-01-1 00,00,00.000 Portugal Time +domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00 +06/02/1433, 00:00:00 +Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time +==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt new file mode 100644 index 0000000000..22b0f6adbe --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt @@ -0,0 +1,33 @@ +--TEST-- +IntlDateFormatter::formatObject(): DateTime tests +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?> +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); +ini_set("intl.default_locale", "pt_PT"); +ini_set("date.timezone", "Europe/Lisbon"); + +$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon +echo IntlDateFormatter::formatObject($dt), "\n"; +echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; +echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n"; +echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n"; +echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n"; + +$dt = new DateTime('2012-01-01 05:00:00+03:00'); +echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; + +?> +==DONE== + +--EXPECTF-- +01/01/2012, 00:00:00 +domingo, 1 de janeiro de 2012 às 00:00:00 Hora padrão %Sda Europa Ocidental +Jan 1, 2012, 12:00:00 AM +1/1/12, 12:00:00 AM Western European Standard %STime +Sun 2012-01-1 00,00,00.000 Portugal Time +domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00 +==DONE== diff --git a/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt b/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt new file mode 100644 index 0000000000..1487751bd6 --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt @@ -0,0 +1,62 @@ +--TEST-- +IntlDateFormatter: get/setTimeZone() +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?> +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); +ini_set("intl.default_locale", "pt_PT"); +ini_set("date.timezone", 'Atlantic/Azores'); + +$ts = strtotime('2012-01-01 00:00:00 UTC'); + +function d(IntlDateFormatter $df) { +global $ts; +echo $df->format($ts), "\n"; +var_dump( +$df->getTimeZoneID(), +$df->getTimeZone()->getID()); +echo "\n"; +} + +$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk'); +d($df); + +$df->setTimeZone(NULL); +d($df); + +$df->setTimeZone('Europe/Madrid'); +d($df); + +$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris')); +d($df); + +$df->setTimeZone(new DateTimeZone('Europe/Amsterdam')); +d($df); + +?> +==DONE== +--EXPECTF-- +domingo, 1 de janeiro de 2012 às 03:00:00 Hor%s do Extremo Leste da Europa +string(12) "Europe/Minsk" +string(12) "Europe/Minsk" + +sábado, 31 de dezembro de 2011 às 23:00:00 Hor%s padrão %Sdos Açores +string(15) "Atlantic/Azores" +string(15) "Atlantic/Azores" + +domingo, 1 de janeiro de 2012 às 01:00:00 Hor%s padrão %Sda Europa Central +string(13) "Europe/Madrid" +string(13) "Europe/Madrid" + +domingo, 1 de janeiro de 2012 às 01:00:00 Hor%s padrão %Sda Europa Central +string(12) "Europe/Paris" +string(12) "Europe/Paris" + +domingo, 1 de janeiro de 2012 às 01:00:00 Hor%s padrão %Sda Europa Central +string(16) "Europe/Amsterdam" +string(16) "Europe/Amsterdam" + +==DONE== diff --git a/ext/intl/tests/formatter_format6.phpt b/ext/intl/tests/formatter_format6.phpt new file mode 100644 index 0000000000..80894c332b --- /dev/null +++ b/ext/intl/tests/formatter_format6.phpt @@ -0,0 +1,130 @@ +--TEST-- +numfmt_format() 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 + +/* + * Format a number using misc locales/patterns. + */ + +/* + * TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed + * currency and percent formatting. + */ + +function ut_main() +{ + $styles = array( + NumberFormatter::PATTERN_DECIMAL => '##.#####################', + NumberFormatter::DECIMAL => '', + NumberFormatter::CURRENCY => '', + NumberFormatter::PERCENT => '', + NumberFormatter::SCIENTIFIC => '', + NumberFormatter::SPELLOUT => '@@@@@@@', + NumberFormatter::ORDINAL => '', + NumberFormatter::DURATION => '', + NumberFormatter::PATTERN_RULEBASED => '#####.###', + 1234999, // bad one + ); + + $integer = array( + NumberFormatter::ORDINAL => '', + NumberFormatter::DURATION => '', + ); + $locales = array( + 'en_US', + 'ru_UA', + 'de', + 'fr', + 'en_UK' + ); + + $str_res = ''; + $number = 1234567.891234567890000; + + foreach( $locales as $locale ) + { + $str_res .= "\nLocale is: $locale\n"; + foreach( $styles as $style => $pattern ) + { + $fmt = ut_nfmt_create( $locale, $style, $pattern ); + + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } + $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; + } + } + return $str_res; +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); + +?> +--EXPECTREGEX-- +Locale is: en_US +'1234567.89123457' +'1,234,567.891' +'\$1,234,567.89' +'123,456,789%' +'1.23456789123457E6' +'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven' +'1,234,567(th|ᵗʰ)' +'342:56:07' +'#####.###' +'USD1,234,567.89' + +Locale is: ru_UA +'1234567,89123457' +'1 234 567,891' +'1 234 567,89 ?(грн\.|₴)' +'123 456 789 ?%' +'1,23456789123457E6' +'один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь целых восемьдесят девять миллионов сто двадцать три тысячи четыреста пятьдесят семь стомиллионных' +'1 234 567.?' +'1 234 567' +'#####.###' +'1 234 567,89 UAH' + +Locale is: de +'1234567,89123457' +'1.234.567,891' +'(¤ )?1.234.567,89( ¤)?' +'123\.456\.789 %' +'1,23456789123457E6' +'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf sieben' +'1.234.567.?' +'1.234.567' +'#####.###' +'1.234.567,89 ¤¤' + +Locale is: fr +'1234567,89123457' +'1 234 567,891' +'1 234 567,89 ¤' +'123 456 789 ?%' +'1,23456789123457E6' +'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept' +'1 234 567e' +'1 234 567' +'#####.###' +'1 234 567,89 ¤¤' + +Locale is: en_UK +'1234567.89123457' +'1,234,567.891' +'¤1,234,567.89' +'123,456,789%' +'1.23456789123457E6' +'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven' +'1,234,567(th|ᵗʰ)' +'342:56:07' +'#####.###' +'¤¤1,234,567.89' diff --git a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt new file mode 100644 index 0000000000..f1306094c4 --- /dev/null +++ b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt @@ -0,0 +1,122 @@ +--TEST-- +numfmt_get/set_text_attribute() 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/set text attribute. + */ + + +function ut_main() +{ + // Array with data for testing + $long_str = str_repeat('blah', 100); + $attributes = array( + 'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ), + 'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ), + 'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ), + 'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ), + 'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ), + 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), +// 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 ) +// 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ), +// 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 ) + ); + + $res_str = ''; + + $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL ); + + foreach( $attributes as $attr_name => $data ) + { + list( $attr, $new_val, $test_number ) = $data; + $res_str .= "\nAttribute $attr_name\n"; + + if( $attr == NumberFormatter::PADDING_CHARACTER ) + ut_nfmt_set_attribute( $fmt, NumberFormatter::FORMAT_WIDTH, 21 ); + + // Get default attribute's value + $def_val = ut_nfmt_get_text_attribute( $fmt, $attr ); + if( $def_val === false ) + $res_str .= "get_text_attribute() error: " . ut_nfmt_get_error_message( $fmt ) . "\n"; + + $res_str .= "Default value: [$def_val]\n"; + $res_str .= "Formatting number with default value: " . ut_nfmt_format( $fmt, $test_number ) . "\n"; + + // Set new attribute's value and see if it works out. + $res_val = ut_nfmt_set_text_attribute( $fmt, $attr, $new_val ); + if( !$res_val ) + $res_str .= "set_text_attribute() error: " . ut_nfmt_get_error_message( $fmt ) . "\n"; + + // Get attribute value back. + $new_val_check = ut_nfmt_get_text_attribute( $fmt, $attr ); + $res_str .= "New value: [$new_val_check]\n"; + $res_str .= "Formatting number with new value: " . ut_nfmt_format( $fmt, $test_number ) . "\n"; + + // Check if the new value has been set. + if( $new_val !== $new_val_check ) + $res_str .= "ERROR: New $attr_name symbol value has not been set correctly.\n"; + + // Restore attribute's value to default + ut_nfmt_set_text_attribute( $fmt, $attr, $def_val ); + + if( $attr == NumberFormatter::PADDING_CHARACTER ) + ut_nfmt_set_attribute( $fmt, NumberFormatter::FORMAT_WIDTH, 0 ); + } + + // + $fmt = ut_nfmt_create( "uk_UA", NumberFormatter::CURRENCY ); + $res_str .= sprintf( "\nCurrency ISO-code for locale 'uk_UA' is: %s\n", + ut_nfmt_get_text_attribute( $fmt, NumberFormatter::CURRENCY_CODE ) ); + + return $res_str; +} + +include_once( 'ut_common.inc' ); +ut_run(); + +?> +--EXPECT-- +Attribute POSITIVE_PREFIX +Default value: [] +Formatting number with default value: 12,345.123 +New value: [_+_] +Formatting number with new value: _+_12,345.123 + +Attribute POSITIVE_SUFFIX +Default value: [] +Formatting number with default value: 12,345.123 +New value: [_+_] +Formatting number with new value: 12,345.123_+_ + +Attribute NEGATIVE_PREFIX +Default value: [-] +Formatting number with default value: -12,345.123 +New value: [_-_] +Formatting number with new value: _-_12,345.123 + +Attribute NEGATIVE_SUFFIX +Default value: [] +Formatting number with default value: -12,345.123 +New value: [_-_] +Formatting number with new value: -12,345.123_-_ + +Attribute PADDING_CHARACTER +Default value: [ ] +Formatting number with default value: 12,345.123 +New value: [^] +Formatting number with new value: ^^^^^^^^^^^12,345.123 + +Attribute POSITIVE_PREFIX-2 +Default value: [] +Formatting number with default value: 12,345.123 +New value: [blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah] +Formatting number with new value: blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah12,345.123 + +Currency ISO-code for locale 'uk_UA' is: UAH + + diff --git a/ext/intl/tests/spoofchecker_005.phpt b/ext/intl/tests/spoofchecker_005.phpt new file mode 100644 index 0000000000..0fc3d52a8c --- /dev/null +++ b/ext/intl/tests/spoofchecker_005.phpt @@ -0,0 +1,29 @@ +--TEST-- +spoofchecker with settings changed +--SKIPIF-- +<?php if(!extension_loaded('intl') || !class_exists("Spoofchecker")) print 'skip'; ?> +<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?> +--FILE-- +<?php + +$korean = "\xED\x95\x9C" . "\xEA\xB5\xAD" . "\xEB\xA7\x90"; + +$x = new Spoofchecker(); +echo "Check with default settings\n"; +var_dump($x->areConfusable("HELLO", "H\xD0\x95LLO")); +var_dump($x->areConfusable("hello", "h\xD0\xB5llo")); + +echo "Change confusable settings\n"; +$x->setChecks(Spoofchecker::MIXED_SCRIPT_CONFUSABLE | + Spoofchecker::WHOLE_SCRIPT_CONFUSABLE | + Spoofchecker::SINGLE_SCRIPT_CONFUSABLE); +var_dump($x->areConfusable("HELLO", "H\xD0\x95LLO")); +var_dump($x->areConfusable("hello", "h\xD0\xB5llo")); +?> +--EXPECTF-- +Check with default settings +bool(true) +bool(true) +Change confusable settings +bool(true) +bool(true) diff --git a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt b/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt new file mode 100644 index 0000000000..4e381289b3 --- /dev/null +++ b/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt @@ -0,0 +1,8 @@ +--TEST-- +Check the function UConverter::getAvailable with parameter wrong +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php UConverter::getAvailable("This is an ascii string"); ?> +--EXPECTF-- +Warning: UConverter::getAvailable() expects exactly 0 parameters, 1 given in %s on line %d |