Skip to content

Commit 9e83ba3

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Backport: Adapt intl timezone test expectations for ICU 79.1 (#24724)
2 parents f35ed4f + 563735d commit 9e83ba3

6 files changed

Lines changed: 110 additions & 0 deletions

‎ext/intl/tests/dateformat_formatObject_calendar_variant_icu72-1.phpt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ IntlDateFormatter::formatObject(): IntlCalendar tests
44
intl
55
--SKIPIF--
66
<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
7+
<?php if (version_compare(INTL_ICU_VERSION, '79.1') >= 0) die('skip for ICU < 79.1'); ?>
78
--FILE--
89
<?php
910
ini_set("intl.error_level", E_WARNING);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--TEST--
2+
IntlDateFormatter::formatObject(): IntlCalendar tests
3+
--EXTENSIONS--
4+
intl
5+
--INI--
6+
intl.default_locale=pt_PT
7+
date.timezone=Europe/Lisbon
8+
--SKIPIF--
9+
<?php if (version_compare(INTL_ICU_VERSION, '79.1') < 0) die('skip for ICU >= 79.1'); ?>
10+
--FILE--
11+
<?php
12+
13+
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
14+
echo IntlDateFormatter::formatObject($cal), "\n";
15+
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
16+
echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
17+
echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
18+
echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
19+
20+
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
21+
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
22+
23+
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
24+
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
25+
echo IntlDateFormatter::formatObject($cal), "\n";
26+
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
27+
28+
?>
29+
--EXPECTF--
30+
01/01/2012, 00:00:00
31+
domingo, 1 de janeiro de 2012 às 00:00:00 Hora padrão %Sda Europa Ocidental
32+
Jan 1, 2012, 12:00:00 AM
33+
1/1/12, 12:00:00 AM Western European Standard Time
34+
Sun 2012-01-1 00,00,00.000 Portugal Time
35+
domingo, 1 de janeiro de 2012 às 05:00:00 +03:00 GMT
36+
06/02/1433, 00:00:00
37+
Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time

‎ext/intl/tests/dateformat_formatObject_datetime_variant_icu72-1.phpt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ IntlDateFormatter::formatObject(): DateTime tests
44
intl
55
--SKIPIF--
66
<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU < 72.1'); ?>
7+
<?php if (version_compare(INTL_ICU_VERSION, '79.1') >= 0) die('skip for ICU < 79.1'); ?>
78
--FILE--
89
<?php
910
ini_set("intl.error_level", E_WARNING);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
IntlDateFormatter::formatObject(): DateTime tests
3+
--EXTENSIONS--
4+
intl
5+
--INI--
6+
intl.default_locale=pt_PT
7+
date.timezone=Europe/Lisbon
8+
--SKIPIF--
9+
<?php if (version_compare(INTL_ICU_VERSION, '79.1') < 0) die('skip for ICU >= 79.1'); ?>
10+
--FILE--
11+
<?php
12+
13+
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
14+
echo IntlDateFormatter::formatObject($dt), "\n";
15+
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
16+
echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
17+
echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
18+
echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
19+
20+
$dt = new DateTime('2012-01-01 05:00:00+03:00');
21+
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
22+
23+
?>
24+
--EXPECTF--
25+
01/01/2012, 00:00:00
26+
domingo, 1 de janeiro de 2012 às 00:00:00 Hora padrão %Sda Europa Ocidental
27+
Jan 1, 2012, 12:00:00 AM
28+
1/1/12, 12:00:00 AM Western European Standard Time
29+
Sun 2012-01-1 00,00,00.000 Portugal Time
30+
domingo, 1 de janeiro de 2012 às 05:00:00 +03:00 GMT

‎ext/intl/tests/timezone_IDforWindowsID_basic_icu76_1.phpt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ IntlTimeZone::getIDForWindowsID basic test
44
intl
55
--SKIPIF--
66
<?php if (version_compare(INTL_ICU_VERSION, '76.1') < 0) die('skip for ICU >= 76.1'); ?>
7+
<?php if (version_compare(INTL_ICU_VERSION, '79.1') >= 0) die('skip for ICU < 79.1'); ?>
78
--FILE--
89
<?php
910

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
IntlTimeZone::getIDForWindowsID basic test
3+
--EXTENSIONS--
4+
intl
5+
--SKIPIF--
6+
<?php if (version_compare(INTL_ICU_VERSION, '79.1') < 0) die('skip for ICU >= 79.1'); ?>
7+
--FILE--
8+
<?php
9+
10+
$tzs = array(
11+
'India Standard Time' => array(NULL),
12+
'Pacific Standard Time' => array('001', 'CA', 'MX', 'US', 'ZZ'),
13+
'Romance Standard Time' => array('001', 'BE', 'DK', 'ES', 'FR'),
14+
);
15+
16+
foreach ($tzs as $tz => $regions) {
17+
echo "** $tz\n";
18+
foreach ($regions as $region) {
19+
var_dump(IntlTimeZone::getIDForWindowsID($tz, $region));
20+
if (intl_get_error_code() != U_ZERO_ERROR) {
21+
echo "Error: ", intl_get_error_message(), "\n";
22+
}
23+
}
24+
}
25+
?>
26+
--EXPECT--
27+
** India Standard Time
28+
string(13) "Asia/Calcutta"
29+
** Pacific Standard Time
30+
string(19) "America/Los_Angeles"
31+
string(19) "America/Los_Angeles"
32+
string(19) "America/Los_Angeles"
33+
string(19) "America/Los_Angeles"
34+
string(19) "America/Los_Angeles"
35+
** Romance Standard Time
36+
string(12) "Europe/Paris"
37+
string(15) "Europe/Brussels"
38+
string(17) "Europe/Copenhagen"
39+
string(13) "Europe/Madrid"
40+
string(12) "Europe/Paris"

0 commit comments

Comments
 (0)