diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-07-23 10:51:19 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-07-23 10:51:19 +0200 |
commit | 3365f28adf90110ca7475df889720fc244820f4b (patch) | |
tree | 5415edde3e396a93f05f887d9f07071871467bdf /ext/intl/tests | |
parent | f0f8d7084aec4be5c07f02f2e29c2820f85c8315 (diff) | |
download | php-3365f28adf90110ca7475df889720fc244820f4b.tar.gz |
Imported Upstream version 5.4.5upstream/5.4.5
Diffstat (limited to 'ext/intl/tests')
-rw-r--r-- | ext/intl/tests/bug62017.phpt | 22 | ||||
-rw-r--r-- | ext/intl/tests/bug62070.phpt | 16 | ||||
-rw-r--r-- | ext/intl/tests/bug62081.phpt | 14 | ||||
-rw-r--r-- | ext/intl/tests/bug62083.phpt | 12 | ||||
-rwxr-xr-x | ext/intl/tests/collator_get_sort_key.phpt | 71 | ||||
-rw-r--r-- | ext/intl/tests/dateformat_calendars.phpt | 45 | ||||
-rwxr-xr-x | ext/intl/tests/formatter_get_error.phpt | 2 | ||||
-rwxr-xr-x | ext/intl/tests/formatter_get_set_attribute.phpt | 10 | ||||
-rw-r--r-- | ext/intl/tests/formatter_get_set_attribute2.phpt | 194 | ||||
-rw-r--r-- | ext/intl/tests/resourcebundle_null_mandatory_args.phpt | 26 | ||||
-rw-r--r-- | ext/intl/tests/resourcebundle_traversable.phpt | 23 |
11 files changed, 199 insertions, 236 deletions
diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt new file mode 100644 index 000000000..13c4fe5df --- /dev/null +++ b/ext/intl/tests/bug62017.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #62017: datefmt_create with incorrectly encoded timezone leaks pattern +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +ini_set('intl.error_level', E_WARNING); +var_dump( + datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF", + IntlDateFormatter::GREGORIAN, 'a')); +var_dump( + new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon", + IntlDateFormatter::GREGORIAN, "\x80")); +--EXPECTF-- +Warning: datefmt_create(): datefmt_create: error converting timezone_str to UTF-16 in %s on line %d +NULL + +Warning: IntlDateFormatter::__construct(): datefmt_create: error converting pattern to UTF-16 in %s on line %d +NULL + diff --git a/ext/intl/tests/bug62070.phpt b/ext/intl/tests/bug62070.phpt new file mode 100644 index 000000000..a466b05c2 --- /dev/null +++ b/ext/intl/tests/bug62070.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #62070: Collator::getSortKey() returns garbage +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +$s1 = 'Hello'; + +$coll = collator_create('en_US'); +$res = collator_get_sort_key($coll, $s1); + +echo urlencode($res); +--EXPECT-- +5%2F%3D%3DC%01%09%01%8F%08 diff --git a/ext/intl/tests/bug62081.phpt b/ext/intl/tests/bug62081.phpt new file mode 100644 index 000000000..7d9e2cec4 --- /dev/null +++ b/ext/intl/tests/bug62081.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #62081: IntlDateFormatter leaks memory if called twice +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +ini_set('intl.error_level', E_WARNING); +$x = new IntlDateFormatter(1,1,1,1,1); +var_dump($x->__construct(1,1,1,1,1)); +--EXPECTF-- +Warning: IntlDateFormatter::__construct(): datefmt_create: cannot call constructor twice in %s on line %d +NULL diff --git a/ext/intl/tests/bug62083.phpt b/ext/intl/tests/bug62083.phpt new file mode 100644 index 000000000..4baa5c5e9 --- /dev/null +++ b/ext/intl/tests/bug62083.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #62083: grapheme_extract() leaks memory +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +$arr1 = array(); +var_dump(grapheme_extract(-1, -1, -1,-1, $arr1)); +--EXPECT-- +bool(false) diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt index 0fedde0ff..a9c4d7134 100755 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -2,8 +2,7 @@ collator_get_sort_key() --SKIPIF-- <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> ---XFAIL-- -Sort keys are not fixed, comparing them to fixed strings doesn't work. +<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip ICU >= 4.8 only'; ?> --FILE-- <?php @@ -18,8 +17,8 @@ function sort_arrays( $locale, $data ) foreach($data as $value) { $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".urlencode($value)."\n". - "key: ".urlencode($res_val)."\n"; + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; } return $res_str; @@ -58,42 +57,42 @@ ut_run(); ?> --EXPECT-- source: abc -key: %29%2B-%01%07%01%07%00 +key: 27292b01070107 source: abd -key: %29%2B%2F%01%07%01%07%00 +key: 27292d01070107 source: aaa -key: %29%29%29%01%07%01%07%00 -source: %D0%B0%D0%B0 -key: _++%01%06%01%06%00 -source: %D0%B0 -key: _+%01%05%01%05%00 +key: 27272701070107 +source: аа +key: 5c0a0a01060106 +source: а +key: 5c0a01050105 source: z -key: %5B%01%05%01%05%00 -source: -key: %01%01%00 -source: -key: %01%01%00 +key: 5901050105 +source: +key: 0101 +source: +key: 0101 source: 3 -key: %26%80%01%05%01%05%00 +key: 1801050105 source: y -key: Y%01%05%01%05%00 +key: 5701050105 source: i -key: 9%01%05%01%05%00 +key: 3701050105 source: k -key: %3D%01%05%01%05%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00
\ No newline at end of file +key: 3b01050105 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: эюя +key: 5d3b3f4501070107 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: эюя +key: 5d3b3f4501070107
\ No newline at end of file diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt new file mode 100644 index 000000000..27f380c71 --- /dev/null +++ b/ext/intl/tests/dateformat_calendars.phpt @@ -0,0 +1,45 @@ +--TEST-- +IntlDateFormatter, calendars and time zone +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); + +$fmt1 = new IntlDateFormatter('en_US', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); +$fmt2 = new IntlDateFormatter('en_US', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); +$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); +var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); +var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); +var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); + +new IntlDateFormatter('en_US@calendar=hebrew', + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); +?> +==DONE== +--EXPECTF-- +string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12" +string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12" +string(42) "Sunday, Tevet 6, 5772 5:12:00 AM GMT+05:12" + +Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN in %s on line %d +==DONE== diff --git a/ext/intl/tests/formatter_get_error.phpt b/ext/intl/tests/formatter_get_error.phpt index c7b397270..acb683e89 100755 --- a/ext/intl/tests/formatter_get_error.phpt +++ b/ext/intl/tests/formatter_get_error.phpt @@ -19,7 +19,7 @@ function ut_main() if( $num === false ) return $fmt->getErrorMessage() . " (" . $fmt->getErrorCode() . ")\n"; else - return "Ooops, an error should have occured."; + return "Ooops, an error should have occurred."; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt index cb5e41575..51c7d3658 100755 --- a/ext/intl/tests/formatter_get_set_attribute.phpt +++ b/ext/intl/tests/formatter_get_set_attribute.phpt @@ -1,8 +1,8 @@ --TEST-- -numfmt_get/set_attribute() icu < 4.2 +numfmt_get/set_attribute() --SKIPIF-- <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> -<?php if(version_compare(INTL_ICU_VERSION, '4.2', '<') != 1) print 'skip'; ?> +<?php if(version_compare(INTL_ICU_VERSION, '4.2', '<') != 1) print 'skip for ICU 4.4+'; ?> --FILE-- <?php @@ -29,7 +29,7 @@ function ut_main() 'ROUNDING_MODE' => array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), + 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 2, 12345.123456 ), 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), @@ -159,7 +159,7 @@ Setting attribute: ok New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 Attribute ROUNDING_INCREMENT -Old attribute value: 1.0E-5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 @@ -171,7 +171,7 @@ New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse Attribute PADDING_POSITION Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +New attribute value: 2 ; Format result: '0,012,345.12346************' ; Parse result: 12345.12346 Attribute SECONDARY_GROUPING_SIZE Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 diff --git a/ext/intl/tests/formatter_get_set_attribute2.phpt b/ext/intl/tests/formatter_get_set_attribute2.phpt deleted file mode 100644 index 7d5fe69dc..000000000 --- a/ext/intl/tests/formatter_get_set_attribute2.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -numfmt_get/set_attribute() icu >= 4.8 ---SKIPIF-- -<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> -<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?> ---FILE-- -<?php - -/* - * Get/set various number formatting attributes. - */ - - -function ut_main() -{ - // attr_name => array( attr, value ) - $attributes = array( - 'PARSE_INT_ONLY' => array( NumberFormatter::PARSE_INT_ONLY, 1, 12345.123456 ), - 'GROUPING_USED' => array( NumberFormatter::GROUPING_USED, 0, 12345.123456 ), - 'DECIMAL_ALWAYS_SHOWN' => array( NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1, 12345 ), - 'MAX_INTEGER_DIGITS' => array( NumberFormatter::MAX_INTEGER_DIGITS, 2, 12345.123456 ), - 'MIN_INTEGER_DIGITS' => array( NumberFormatter::MIN_INTEGER_DIGITS, 20, 12345.123456 ), - 'INTEGER_DIGITS' => array( NumberFormatter::INTEGER_DIGITS, 7, 12345.123456 ), - 'MAX_FRACTION_DIGITS' => array( NumberFormatter::MAX_FRACTION_DIGITS, 2, 12345.123456 ), - 'MIN_FRACTION_DIGITS' => array( NumberFormatter::MIN_FRACTION_DIGITS, 20, 12345.123456 ), - 'FRACTION_DIGITS' => array( NumberFormatter::FRACTION_DIGITS, 5, 12345.123456 ), - 'MULTIPLIER' => array( NumberFormatter::MULTIPLIER, 2, 12345.123456 ), - 'GROUPING_SIZE' => array( NumberFormatter::GROUPING_SIZE, 2, 12345.123456 ), - 'ROUNDING_MODE' => array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), - 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), - 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), - 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), - 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), - 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), - 'MAX_SIGNIFICANT_DIGITS' => array( NumberFormatter::MAX_SIGNIFICANT_DIGITS, 4, 12345.123456 ), - // 'LENIENT_PARSE' => array( NumberFormatter::LENIENT_PARSE, 2, 12345.123456 ) - ); - - $res_str = ''; - - $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL ); - - foreach( $attributes as $attr_name => $args ) - { - list( $attr, $new_val, $number ) = $args; - $res_str .= "\nAttribute $attr_name\n"; - - // Get original value of the attribute. - $orig_val = ut_nfmt_get_attribute( $fmt, $attr ); - - // Format the number using the original attribute value. - $rc = ut_nfmt_format( $fmt, $number ); - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "Old attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $orig_val ), - dump( $rc ), - dump( $ps ) ); - - // Set new attribute value. - $rc = ut_nfmt_set_attribute( $fmt, $attr, $new_val ); - if( $rc ) - $res_str .= "Setting attribute: ok\n"; - else - $res_str .= sprintf( "Setting attribute failed: %s\n", ut_nfmt_get_error_message( $fmt ) ); - - // Format the number using the new value. - $rc = ut_nfmt_format( $fmt, $number ); - - // Get current value of the attribute and check if it equals $new_val. - $attr_val_check = ut_nfmt_get_attribute( $fmt, $attr ); - if( $attr_val_check !== $new_val ) - $res_str .= "ERROR: New $attr_name attribute value has not been set correctly.\n"; - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "New attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $new_val ), - dump( $rc ), - dump( $ps ) ); - - - // Restore original attribute of the value - if( $attr != NumberFormatter::INTEGER_DIGITS && $attr != NumberFormatter::FRACTION_DIGITS - && $attr != NumberFormatter::FORMAT_WIDTH && $attr != NumberFormatter::SIGNIFICANT_DIGITS_USED ) - ut_nfmt_set_attribute( $fmt, $attr, $orig_val ); - } - - return $res_str; -} - -include_once( 'ut_common.inc' ); - -// Run the test -ut_run(); - -?> ---EXPECT-- -Attribute PARSE_INT_ONLY -Old attribute value: 0 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345 - -Attribute GROUPING_USED -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 0 ; Format result: '12345.123' ; Parse result: 12345.123 - -Attribute DECIMAL_ALWAYS_SHOWN -Old attribute value: 0 ; Format result: '12,345' ; Parse result: 12345 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.' ; Parse result: 12345 - -Attribute MAX_INTEGER_DIGITS -Old attribute value: 309 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '45.123' ; Parse result: 45.123 - -Attribute MIN_INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '00,000,000,000,000,012,345.123' ; Parse result: 12345.123 - -Attribute INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 7 ; Format result: '0,012,345.123' ; Parse result: 12345.123 - -Attribute MAX_FRACTION_DIGITS -Old attribute value: 3 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,345.12' ; Parse result: 12345.12 - -Attribute MIN_FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '0,012,345.12345600000000000000' ; Parse result: 12345.123456 - -Attribute FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123456' ; Parse result: 12345.123456 -Setting attribute: ok -New attribute value: 5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute MULTIPLIER -Old attribute value: 1 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,024,690.24691' ; Parse result: 12345.123455 - -Attribute GROUPING_SIZE -Old attribute value: 3 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,01,23,45.12346' ; Parse result: 12345.12346 - -Attribute ROUNDING_MODE -Old attribute value: 4 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 - -Attribute ROUNDING_INCREMENT -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 - -Attribute FORMAT_WIDTH -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 - -Attribute PADDING_POSITION -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute SECONDARY_GROUPING_SIZE -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '************00,12,345.12346' ; Parse result: 12345.12346 - -Attribute SIGNIFICANT_DIGITS_USED -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 - -Attribute MIN_SIGNIFICANT_DIGITS -Old attribute value: 1 ; Format result: '**************************1' ; Parse result: 1 -Setting attribute: ok -New attribute value: 3 ; Format result: '***********************1.00' ; Parse result: 1 - -Attribute MAX_SIGNIFICANT_DIGITS -Old attribute value: 6 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 -Setting attribute: ok -New attribute value: 4 ; Format result: '*********************12,350' ; Parse result: 12350 diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt new file mode 100644 index 000000000..8fde61bd2 --- /dev/null +++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt @@ -0,0 +1,26 @@ +--TEST-- +IntlCalendar::setTime() basic test +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); + +$r = new ResourceBundle('en_US', NULL); +$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0); +var_dump($c); + +ini_set('intl.default_locale', 'pt_PT'); +$r = new ResourceBundle(NULL, NULL); +$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0); +var_dump($c); +?> +==DONE== +--EXPECT-- +string(14) "h:mm:ss a zzzz" +string(12) "H:mm:ss zzzz" +==DONE== diff --git a/ext/intl/tests/resourcebundle_traversable.phpt b/ext/intl/tests/resourcebundle_traversable.phpt new file mode 100644 index 000000000..1e6af7b90 --- /dev/null +++ b/ext/intl/tests/resourcebundle_traversable.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #55610: ResourceBundle does not implement Traversable +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php + include "resourcebundle.inc"; + + $r = new ResourceBundle( 'es', BUNDLE ); + + var_dump($r instanceof Traversable); + var_dump(iterator_to_array($r->get('testarray'))); +?> +--EXPECTF-- +bool(true) +array(3) { + [0]=> + string(8) "cadena 1" + [1]=> + string(8) "cadena 2" + [2]=> + string(8) "cadena 3" +} |