[php-src] Issue #12618: Flaky test for IntlDateFormatter [dateformat_format_relative.phpt]
| From: | SakiTakamachi | Date: | Mon, 06 Nov 2023 11:27:11 +0000 |
| Subject: | [php-src] Issue #12618: Flaky test for IntlDateFormatter [dateformat_format_relative.phpt] | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245748@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12618
Author: SakiTakamachi
### Description
The test fails at certain times.
https://github.com/php/php-src/actions/runs/6767338868/job/18389812623
The following code:
```
<?php
$formatter = new IntlDateFormatter(
"en_US",
IntlDateFormatter::RELATIVE_FULL,
IntlDateFormatter::NONE,
"America/Los_Angeles",
IntlDateFormatter::GREGORIAN,
);
echo $formatter->format(new DateTimeImmutable("yesterday"));
```
result:
```
Saturday, November 4, 2023 // now is 2023-11-06 11:08:00 UTC
```
This is due to time zone mismatch. I thought it would be enough to just specify the time zone in
DateTimeImmutable, but there are places in the test where it is purposely set to UTC,
so I don't know what the purpose of the test is.
https://github.com/php/php-src/blob/4022e287b20c310761d15efb64fb14aa080b18ed/ext/intl/tests/dateformat_format_relative.phpt#L53
Is it okay to just set the time zones?
Regards.
### PHP Version
PHP8.1 ~ master
### Operating System
_No response_