mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-15 20:25:17 +03:00
735 lines
29 KiB
Diff
735 lines
29 KiB
Diff
Patch-Source: https://github.com/php/php-src/pull/9800
|
||
|
||
From 55dc54834c556cb2b8dc44bd7b3bc2a89bfd1f19 Mon Sep 17 00:00:00 2001
|
||
From: "Christoph M. Becker" <cmbecker69@gmx.de>
|
||
Date: Fri, 21 Oct 2022 17:21:16 +0200
|
||
Subject: [PATCH] Adapt ext/intl tests for ICU 72.1
|
||
|
||
This version replaces SPACEs before the meridian with NARROW NO-BREAK
|
||
SPACEs. Thus, we split the affected test cases as usual.
|
||
---
|
||
.../tests/dateformat_calendars_variant3.phpt | 1 +
|
||
.../tests/dateformat_calendars_variant4.phpt | 48 +++
|
||
ext/intl/tests/dateformat_create_default.phpt | 2 +
|
||
.../tests/dateformat_create_default2.phpt | 26 ++
|
||
...format_formatObject_calendar_variant5.phpt | 1 +
|
||
...format_formatObject_calendar_variant6.phpt | 37 +++
|
||
...format_formatObject_datetime_variant5.phpt | 1 +
|
||
...format_formatObject_datetime_variant6.phpt | 30 ++
|
||
.../dateformat_format_parse_version2.phpt | 1 +
|
||
.../dateformat_format_parse_version3.phpt | 296 ++++++++++++++++++
|
||
.../tests/dateformat_set_timezone_id3.phpt | 1 +
|
||
.../tests/dateformat_set_timezone_id4.phpt | 85 +++++
|
||
...datepatterngenerator_get_best_pattern.phpt | 2 +
|
||
...atepatterngenerator_get_best_pattern2.phpt | 38 +++
|
||
ext/intl/tests/msgfmt_format_datetime.phpt | 2 +
|
||
ext/intl/tests/msgfmt_format_datetime2.phpt | 29 ++
|
||
...t_format_simple_types_numeric_strings.phpt | 2 +
|
||
..._format_simple_types_numeric_strings2.phpt | 54 ++++
|
||
...cebundle_null_mandatory_args_variant2.phpt | 1 +
|
||
...cebundle_null_mandatory_args_variant3.phpt | 24 ++
|
||
20 files changed, 681 insertions(+)
|
||
create mode 100644 ext/intl/tests/dateformat_calendars_variant4.phpt
|
||
create mode 100644 ext/intl/tests/dateformat_create_default2.phpt
|
||
create mode 100644 ext/intl/tests/dateformat_formatObject_calendar_variant6.phpt
|
||
create mode 100644 ext/intl/tests/dateformat_formatObject_datetime_variant6.phpt
|
||
create mode 100644 ext/intl/tests/dateformat_format_parse_version3.phpt
|
||
create mode 100644 ext/intl/tests/dateformat_set_timezone_id4.phpt
|
||
create mode 100644 ext/intl/tests/datepatterngenerator_get_best_pattern2.phpt
|
||
create mode 100644 ext/intl/tests/msgfmt_format_datetime2.phpt
|
||
create mode 100644 ext/intl/tests/msgfmt_format_simple_types_numeric_strings2.phpt
|
||
create mode 100644 ext/intl/tests/resourcebundle_null_mandatory_args_variant3.phpt
|
||
|
||
diff --git a/ext/intl/tests/dateformat_calendars_variant3.phpt b/ext/intl/tests/dateformat_calendars_variant3.phpt
|
||
index d189361bcffb..1ad970d07d0e 100644
|
||
--- a/ext/intl/tests/dateformat_calendars_variant3.phpt
|
||
+++ b/ext/intl/tests/dateformat_calendars_variant3.phpt
|
||
@@ -6,6 +6,7 @@ date.timezone=Atlantic/Azores
|
||
intl
|
||
--SKIPIF--
|
||
<?php if (version_compare(INTL_ICU_VERSION, '54.1') < 0) die('skip for ICU >= 54.1'); ?>
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
|
||
--FILE--
|
||
<?php
|
||
ini_set("intl.error_level", E_WARNING);
|
||
diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt
|
||
index 494b66768906..9eb9f39a917a 100644
|
||
--- a/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt
|
||
+++ b/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt
|
||
@@ -4,6 +4,7 @@ IntlDateFormatter::formatObject(): IntlCalendar tests
|
||
intl
|
||
--SKIPIF--
|
||
<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?>
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
|
||
--FILE--
|
||
<?php
|
||
ini_set("intl.error_level", E_WARNING);
|
||
diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant6.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant6.phpt
|
||
new file mode 100644
|
||
index 000000000000..fc5ddb6fc4fe
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/dateformat_formatObject_calendar_variant6.phpt
|
||
@@ -0,0 +1,37 @@
|
||
+--TEST--
|
||
+IntlDateFormatter::formatObject(): IntlCalendar tests
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.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";
|
||
+
|
||
+?>
|
||
+--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 Time
|
||
+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
|
||
diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt
|
||
index b51a46d7f397..b3c2ecc8e793 100644
|
||
--- a/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt
|
||
+++ b/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt
|
||
@@ -4,6 +4,7 @@ IntlDateFormatter::formatObject(): DateTime tests
|
||
intl
|
||
--SKIPIF--
|
||
<?php if (version_compare(INTL_ICU_VERSION, '55.1') < 0) die('skip for ICU >= 55.1'); ?>
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
|
||
--FILE--
|
||
<?php
|
||
ini_set("intl.error_level", E_WARNING);
|
||
diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant6.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant6.phpt
|
||
new file mode 100644
|
||
index 000000000000..fe30d1f85ac1
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/dateformat_formatObject_datetime_variant6.phpt
|
||
@@ -0,0 +1,30 @@
|
||
+--TEST--
|
||
+IntlDateFormatter::formatObject(): DateTime tests
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU < 72.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";
|
||
+
|
||
+?>
|
||
+--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 Time
|
||
+Sun 2012-01-1 00,00,00.000 Portugal Time
|
||
+domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00
|
||
diff --git a/ext/intl/tests/dateformat_format_parse_version2.phpt b/ext/intl/tests/dateformat_format_parse_version2.phpt
|
||
index 19e7d914adcf..1293d29c383b 100644
|
||
--- a/ext/intl/tests/dateformat_format_parse_version2.phpt
|
||
+++ b/ext/intl/tests/dateformat_format_parse_version2.phpt
|
||
@@ -4,6 +4,7 @@ datefmt_format_code() and datefmt_parse_code()
|
||
intl
|
||
--SKIPIF--
|
||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
|
||
--FILE--
|
||
<?php
|
||
|
||
diff --git a/ext/intl/tests/dateformat_format_parse_version3.phpt b/ext/intl/tests/dateformat_format_parse_version3.phpt
|
||
new file mode 100644
|
||
index 000000000000..890546fa7115
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/dateformat_format_parse_version3.phpt
|
||
@@ -0,0 +1,296 @@
|
||
+--TEST--
|
||
+datefmt_format_code() and datefmt_parse_code()
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
|
||
+--FILE--
|
||
+<?php
|
||
+
|
||
+/*
|
||
+ * Test for the datefmt_format function
|
||
+ */
|
||
+
|
||
+
|
||
+function ut_main()
|
||
+{
|
||
+ $timezone = 'GMT+05:00';
|
||
+
|
||
+ $locale_arr = array (
|
||
+ 'en_US'
|
||
+ );
|
||
+
|
||
+ $datetype_arr = array (
|
||
+ IntlDateFormatter::FULL,
|
||
+ IntlDateFormatter::LONG,
|
||
+ IntlDateFormatter::MEDIUM
|
||
+ );
|
||
+
|
||
+ $res_str = '';
|
||
+
|
||
+
|
||
+ $time_arr = array (
|
||
+ 0,
|
||
+ -1200000,
|
||
+ 1200000,
|
||
+ 2200000000,
|
||
+ -2200000000,
|
||
+ 90099999,
|
||
+ 3600,
|
||
+ -3600
|
||
+ );
|
||
+
|
||
+ $localtime_arr1 = array (
|
||
+ 'tm_sec' => 24 ,
|
||
+ 'tm_min' => 3,
|
||
+ 'tm_hour' => 19,
|
||
+ 'tm_mday' => 3,
|
||
+ 'tm_mon' => 3,
|
||
+ 'tm_year' => 105,
|
||
+ );
|
||
+ $localtime_arr2 = array (
|
||
+ 'tm_sec' => 21,
|
||
+ 'tm_min' => 5,
|
||
+ 'tm_hour' => 7,
|
||
+ 'tm_mday' => 13,
|
||
+ 'tm_mon' => 7,
|
||
+ 'tm_year' => 205,
|
||
+ );
|
||
+ $localtime_arr3 = array (
|
||
+ 'tm_sec' => 11,
|
||
+ 'tm_min' => 13,
|
||
+ 'tm_hour' => 0,
|
||
+ 'tm_mday' => 17,
|
||
+ 'tm_mon' => 11,
|
||
+ 'tm_year' => -5
|
||
+ );
|
||
+
|
||
+ $localtime_arr = array (
|
||
+ $localtime_arr1,
|
||
+ $localtime_arr2,
|
||
+ $localtime_arr3
|
||
+ );
|
||
+
|
||
+ //Test format and parse with a timestamp : long
|
||
+ foreach( $time_arr as $timestamp_entry){
|
||
+ $res_str .= "\n------------\n";
|
||
+ $res_str .= "\nInput timestamp is : $timestamp_entry";
|
||
+ $res_str .= "\n------------\n";
|
||
+ foreach( $locale_arr as $locale_entry ){
|
||
+ foreach( $datetype_arr as $datetype_entry ) {
|
||
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
|
||
+ $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
|
||
+ $res_str .= "\nFormatted timestamp is : $formatted";
|
||
+ $parsed = ut_datefmt_parse( $fmt , $formatted);
|
||
+ if( intl_get_error_code() == U_ZERO_ERROR){
|
||
+ $res_str .= "\nParsed timestamp is : $parsed";
|
||
+ }else{
|
||
+ $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
|
||
+ }
|
||
+ }
|
||
+ }
|
||
+ }
|
||
+
|
||
+ //Test format and parse with a localtime :array
|
||
+ foreach( $localtime_arr as $localtime_entry){
|
||
+ $res_str .= "\n------------\n";
|
||
+ $res_str .= "\nInput localtime is : ";
|
||
+ foreach( $localtime_entry as $key => $value){
|
||
+ $res_str .= "$key : '$value' , ";
|
||
+ }
|
||
+
|
||
+ $res_str .= "\n------------\n";
|
||
+ foreach( $locale_arr as $locale_entry ){
|
||
+ foreach( $datetype_arr as $datetype_entry ) {
|
||
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
|
||
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
|
||
+ $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
|
||
+ if( intl_get_error_code() == U_ZERO_ERROR){
|
||
+ $res_str .= "\nFormatted localtime_array is : $formatted1";
|
||
+ }else{
|
||
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
|
||
+ }
|
||
+ //Parsing
|
||
+ $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 );
|
||
+
|
||
+ if( $parsed_arr){
|
||
+ $res_str .= "\nParsed array is: ";
|
||
+ foreach( $parsed_arr as $key => $value){
|
||
+ $res_str .= "$key : '$value' , ";
|
||
+ }
|
||
+ }
|
||
+/*
|
||
+ else{
|
||
+ //$res_str .= "No values found from LocaleTime parsing.";
|
||
+ $res_str .= "\tError : '".intl_get_error_message()."'";
|
||
+ }
|
||
+*/
|
||
+ }
|
||
+ }
|
||
+ }
|
||
+
|
||
+ return $res_str;
|
||
+
|
||
+}
|
||
+
|
||
+include_once( 'ut_common.inc' );
|
||
+
|
||
+// Run the test
|
||
+ut_run();
|
||
+?>
|
||
+--EXPECT--
|
||
+------------
|
||
+
|
||
+Input timestamp is : 0
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Thursday, January 1, 1970 at 5:00:00 AM GMT+05:00
|
||
+Parsed timestamp is : 0
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : January 1, 1970 at 5:00:00 AM GMT+5
|
||
+Parsed timestamp is : 0
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Jan 1, 1970, 5:00:00 AM
|
||
+Parsed timestamp is : 0
|
||
+------------
|
||
+
|
||
+Input timestamp is : -1200000
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Thursday, December 18, 1969 at 7:40:00 AM GMT+05:00
|
||
+Parsed timestamp is : -1200000
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : December 18, 1969 at 7:40:00 AM GMT+5
|
||
+Parsed timestamp is : -1200000
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Dec 18, 1969, 7:40:00 AM
|
||
+Parsed timestamp is : -1200000
|
||
+------------
|
||
+
|
||
+Input timestamp is : 1200000
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Thursday, January 15, 1970 at 2:20:00 AM GMT+05:00
|
||
+Parsed timestamp is : 1200000
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : January 15, 1970 at 2:20:00 AM GMT+5
|
||
+Parsed timestamp is : 1200000
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Jan 15, 1970, 2:20:00 AM
|
||
+Parsed timestamp is : 1200000
|
||
+------------
|
||
+
|
||
+Input timestamp is : 2200000000
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Monday, September 19, 2039 at 4:06:40 AM GMT+05:00
|
||
+Parsed timestamp is : 2200000000
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : September 19, 2039 at 4:06:40 AM GMT+5
|
||
+Parsed timestamp is : 2200000000
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Sep 19, 2039, 4:06:40 AM
|
||
+Parsed timestamp is : 2200000000
|
||
+------------
|
||
+
|
||
+Input timestamp is : -2200000000
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Sunday, April 15, 1900 at 5:53:20 AM GMT+05:00
|
||
+Parsed timestamp is : -2200000000
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : April 15, 1900 at 5:53:20 AM GMT+5
|
||
+Parsed timestamp is : -2200000000
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Apr 15, 1900, 5:53:20 AM
|
||
+Parsed timestamp is : -2200000000
|
||
+------------
|
||
+
|
||
+Input timestamp is : 90099999
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Thursday, November 9, 1972 at 12:46:39 AM GMT+05:00
|
||
+Parsed timestamp is : 90099999
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : November 9, 1972 at 12:46:39 AM GMT+5
|
||
+Parsed timestamp is : 90099999
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Nov 9, 1972, 12:46:39 AM
|
||
+Parsed timestamp is : 90099999
|
||
+------------
|
||
+
|
||
+Input timestamp is : 3600
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Thursday, January 1, 1970 at 6:00:00 AM GMT+05:00
|
||
+Parsed timestamp is : 3600
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : January 1, 1970 at 6:00:00 AM GMT+5
|
||
+Parsed timestamp is : 3600
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Jan 1, 1970, 6:00:00 AM
|
||
+Parsed timestamp is : 3600
|
||
+------------
|
||
+
|
||
+Input timestamp is : -3600
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted timestamp is : Thursday, January 1, 1970 at 4:00:00 AM GMT+05:00
|
||
+Parsed timestamp is : -3600
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted timestamp is : January 1, 1970 at 4:00:00 AM GMT+5
|
||
+Parsed timestamp is : -3600
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted timestamp is : Jan 1, 1970, 4:00:00 AM
|
||
+Parsed timestamp is : -3600
|
||
+------------
|
||
+
|
||
+Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' ,
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted localtime_array is : Sunday, April 3, 2005 at 7:03:24 PM GMT+05:00
|
||
+Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' ,
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted localtime_array is : April 3, 2005 at 7:03:24 PM GMT+5
|
||
+Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' ,
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted localtime_array is : Apr 3, 2005, 7:03:24 PM
|
||
+Parsed array is: tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_year : '105' , tm_mday : '3' , tm_wday : '0' , tm_yday : '93' , tm_mon : '3' , tm_isdst : '0' ,
|
||
+------------
|
||
+
|
||
+Input localtime is : tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_mday : '13' , tm_mon : '7' , tm_year : '205' ,
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted localtime_array is : Thursday, August 13, 2105 at 7:05:21 AM GMT+05:00
|
||
+Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' ,
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted localtime_array is : August 13, 2105 at 7:05:21 AM GMT+5
|
||
+Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' ,
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted localtime_array is : Aug 13, 2105, 7:05:21 AM
|
||
+Parsed array is: tm_sec : '21' , tm_min : '5' , tm_hour : '7' , tm_year : '205' , tm_mday : '13' , tm_wday : '4' , tm_yday : '225' , tm_mon : '7' , tm_isdst : '0' ,
|
||
+------------
|
||
+
|
||
+Input localtime is : tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_mday : '17' , tm_mon : '11' , tm_year : '-5' ,
|
||
+------------
|
||
+
|
||
+IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
|
||
+Formatted localtime_array is : Tuesday, December 17, 1895 at 12:13:11 AM GMT+05:00
|
||
+Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' ,
|
||
+IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
|
||
+Formatted localtime_array is : December 17, 1895 at 12:13:11 AM GMT+5
|
||
+Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' ,
|
||
+IntlDateFormatter locale= en_US ,datetype = 2 ,timetype =2
|
||
+Formatted localtime_array is : Dec 17, 1895, 12:13:11 AM
|
||
+Parsed array is: tm_sec : '11' , tm_min : '13' , tm_hour : '0' , tm_year : '-5' , tm_mday : '17' , tm_wday : '2' , tm_yday : '351' , tm_mon : '11' , tm_isdst : '0' ,
|
||
diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt
|
||
index e0d7cd0e5260..a4952eb5a3dc 100644
|
||
--- a/ext/intl/tests/dateformat_set_timezone_id3.phpt
|
||
+++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt
|
||
@@ -6,6 +6,7 @@ date.timezone=Atlantic/Azores
|
||
intl
|
||
--SKIPIF--
|
||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
|
||
--FILE--
|
||
<?php
|
||
|
||
diff --git a/ext/intl/tests/dateformat_set_timezone_id4.phpt b/ext/intl/tests/dateformat_set_timezone_id4.phpt
|
||
new file mode 100644
|
||
index 000000000000..aedf886da2dd
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/dateformat_set_timezone_id4.phpt
|
||
@@ -0,0 +1,85 @@
|
||
+--TEST--
|
||
+datefmt_set_timezone_id_code() icu >= 4.8
|
||
+--INI--
|
||
+date.timezone=Atlantic/Azores
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
|
||
+--FILE--
|
||
+<?php
|
||
+
|
||
+ini_set("intl.error_level", E_WARNING);
|
||
+
|
||
+/*
|
||
+ * Test for the datefmt_set_timezone_id function
|
||
+ */
|
||
+
|
||
+
|
||
+function ut_main()
|
||
+{
|
||
+ $timezone_id_arr = array (
|
||
+ 'America/New_York',
|
||
+ 'America/Los_Angeles',
|
||
+ 'America/Chicago',
|
||
+ 'CN'
|
||
+ );
|
||
+ $timestamp_entry = 0;
|
||
+
|
||
+ $res_str = '';
|
||
+
|
||
+ $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
|
||
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
|
||
+ $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
|
||
+
|
||
+ foreach( $timezone_id_arr as $timezone_id_entry )
|
||
+ {
|
||
+
|
||
+ $res_str .= "-----------";
|
||
+ $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
|
||
+ ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
|
||
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
|
||
+ $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
|
||
+ $formatted = ut_datefmt_format( $fmt, 0);
|
||
+ $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
|
||
+ $formatted = ut_datefmt_format( $fmt, 3600);
|
||
+ $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
|
||
+ $res_str .= "\n";
|
||
+
|
||
+ }
|
||
+
|
||
+ return $res_str;
|
||
+
|
||
+}
|
||
+
|
||
+include_once( 'ut_common.inc' );
|
||
+
|
||
+// Run the test
|
||
+ut_run();
|
||
+?>
|
||
+--EXPECTF--
|
||
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: No such time zone: 'CN' in %sut_common.inc on line %d
|
||
+
|
||
+Warning: datefmt_set_timezone(): datefmt_set_timezone: No such time zone: 'CN' in %sut_common.inc on line %d
|
||
+
|
||
+After creation of the dateformatter : timezone_id= US/Pacific
|
||
+-----------
|
||
+Trying to set timezone_id= America/New_York
|
||
+After call to set_timezone_id : timezone_id= America/New_York
|
||
+Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Eastern Standard Time
|
||
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 8:00:00 PM Eastern Standard Time
|
||
+-----------
|
||
+Trying to set timezone_id= America/Los_Angeles
|
||
+After call to set_timezone_id : timezone_id= America/Los_Angeles
|
||
+Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time
|
||
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 5:00:00 PM Pacific Standard Time
|
||
+-----------
|
||
+Trying to set timezone_id= America/Chicago
|
||
+After call to set_timezone_id : timezone_id= America/Chicago
|
||
+Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time
|
||
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time
|
||
+-----------
|
||
+Trying to set timezone_id= CN
|
||
+After call to set_timezone_id : timezone_id= America/Chicago
|
||
+Formatting timestamp=0 resulted in Wednesday, December 31, 1969 at 6:00:00 PM Central Standard Time
|
||
+Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 at 7:00:00 PM Central Standard Time
|
||
diff --git a/ext/intl/tests/msgfmt_format_datetime.phpt b/ext/intl/tests/msgfmt_format_datetime.phpt
|
||
index 8b3e37ab30f5..e6a7451906f7 100644
|
||
--- a/ext/intl/tests/msgfmt_format_datetime.phpt
|
||
+++ b/ext/intl/tests/msgfmt_format_datetime.phpt
|
||
@@ -6,6 +6,7 @@
|
||
<?php
|
||
if (!extension_loaded('intl'))
|
||
die('skip intl extension not enabled');
|
||
+if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1');
|
||
--FILE--
|
||
<?php
|
||
ini_set("intl.error_level", E_WARNING);
|
||
diff --git a/ext/intl/tests/msgfmt_format_datetime2.phpt b/ext/intl/tests/msgfmt_format_datetime2.phpt
|
||
new file mode 100644
|
||
index 000000000000..743b1d8b11c5
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/msgfmt_format_datetime2.phpt
|
||
@@ -0,0 +1,29 @@
|
||
+--TEST--
|
||
+MessageFormatter::format(): DateTime accepted to format dates and times
|
||
+--INI--
|
||
+date.timezone=Atlantic/Azores
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
|
||
+--FILE--
|
||
+<?php
|
||
+ini_set("intl.error_level", E_WARNING);
|
||
+//ini_set("intl.default_locale", "nl");
|
||
+
|
||
+$fmt = <<<EOD
|
||
+{0,date} {0,time}
|
||
+EOD;
|
||
+
|
||
+$dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
|
||
+$dti = new DateTimeImmutable("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
|
||
+
|
||
+$mf = new MessageFormatter('en_US', $fmt);
|
||
+
|
||
+var_dump($mf->format(array($dt)));
|
||
+var_dump($mf->format(array($dti)));
|
||
+
|
||
+?>
|
||
+--EXPECT--
|
||
+string(24) "May 6, 2012 5:00:42 PM"
|
||
+string(24) "May 6, 2012 5:00:42 PM"
|
||
diff --git a/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt
|
||
index 9bc38b683cd0..f92eaa2bdb54 100644
|
||
--- a/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt
|
||
+++ b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt
|
||
@@ -6,6 +6,7 @@
|
||
<?php
|
||
if (!extension_loaded('intl'))
|
||
die('skip intl extension not enabled');
|
||
+if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1');
|
||
--FILE--
|
||
<?php
|
||
ini_set("intl.error_level", E_WARNING);
|
||
diff --git a/ext/intl/tests/msgfmt_format_simple_types_numeric_strings2.phpt b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings2.phpt
|
||
new file mode 100644
|
||
index 000000000000..67093ddd8604
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings2.phpt
|
||
@@ -0,0 +1,54 @@
|
||
+--TEST--
|
||
+MessageFormatter::format(): simple types handling with numeric strings
|
||
+--INI--
|
||
+date.timezone=Atlantic/Azores
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
|
||
+--FILE--
|
||
+<?php
|
||
+ini_set("intl.error_level", E_WARNING);
|
||
+//ini_set("intl.default_locale", "nl");
|
||
+
|
||
+$mf = new MessageFormatter('en_US',"
|
||
+ none {a}
|
||
+ number {b,number}
|
||
+ number integer {c,number,integer}
|
||
+ number currency {d,number,currency}
|
||
+ number percent {e,number,percent}
|
||
+ date {f,date}
|
||
+ time {g,time}
|
||
+ spellout {h,spellout}
|
||
+ ordinal {i,ordinal}
|
||
+ duration {j,duration}
|
||
+");
|
||
+
|
||
+$ex = "1336317965.5 str";
|
||
+var_dump($mf->format(array(
|
||
+'a' => $ex,
|
||
+'b' => $ex,
|
||
+'c' => $ex,
|
||
+'d' => $ex,
|
||
+'e' => $ex,
|
||
+'f' => " 1336317965.5",
|
||
+'g' => " 1336317965.5",
|
||
+'h' => $ex,
|
||
+'i' => $ex,
|
||
+'j' => $ex,
|
||
+)));
|
||
+
|
||
+?>
|
||
+--EXPECTF--
|
||
+string(%d) "
|
||
+ none 1336317965.5 str
|
||
+ number 1,336,317,965.5
|
||
+ number integer 1,336,317,965
|
||
+ number currency $1,336,317,965.50
|
||
+ number percent 133,631,796,550%
|
||
+ date May %d, 2012
|
||
+ time 3:26:05 PM
|
||
+ spellout one billion three hundred thirty-six million three hundred seventeen thousand nine hundred sixty-five point five
|
||
+ ordinal 1,336,317,966th
|
||
+ duration 371,199:26:06
|
||
+"
|
||
diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt
|
||
index 31250027184b..5aefcf268dff 100644
|
||
--- a/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt
|
||
+++ b/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt
|
||
@@ -6,6 +6,7 @@ date.timezone=Atlantic/Azores
|
||
intl
|
||
--SKIPIF--
|
||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
|
||
--FILE--
|
||
<?php
|
||
ini_set("intl.error_level", E_WARNING);
|
||
diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args_variant3.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args_variant3.phpt
|
||
new file mode 100644
|
||
index 000000000000..d3e2615e0f49
|
||
--- /dev/null
|
||
+++ b/ext/intl/tests/resourcebundle_null_mandatory_args_variant3.phpt
|
||
@@ -0,0 +1,24 @@
|
||
+--TEST--
|
||
+ResourceBundle constructor bundle accepts NULL for first two arguments
|
||
+--INI--
|
||
+date.timezone=Atlantic/Azores
|
||
+--EXTENSIONS--
|
||
+intl
|
||
+--SKIPIF--
|
||
+<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
|
||
+--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);
|
||
+?>
|
||
+--EXPECT--
|
||
+string(16) "h:mm:ss a zzzz"
|
||
+string(13) "HH:mm:ss zzzz"
|