php-src/ext/intl/tests/msgfmt_format_datetime_icu72-1.phpt
Gina Peter Banyard c42e6d62d8
ext/intl: modernize tests (#19392)
This is effectively removing ZPP tests, enabling warnings, and moving INI settings into the INI PHPT block
2025-08-06 23:33:48 +01:00

25 lines
628 B
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--TEST--
MessageFormatter::format(): DateTime accepted to format dates and times
--EXTENSIONS--
intl
--SKIPIF--
<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
--FILE--
<?php
$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:42PM"
string(24) "May 6, 2012 5:00:42PM"