From 65c93a6d80218b288e5178ba2692da563bb5015e Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Tue, 31 Jan 2023 11:08:23 -0500 Subject: [PATCH] Fix broken short date test with ICU >= 72.1 * tests/Rcmail/Rcmail.php (test_format_date): Starting with ICU 72.1, a NARROW NO-BREAK SPACE (NNBSP) is used instead of an ASCII space before the meridian. So, check for an NNBSP when using ICU >= 72.1. References: * https://icu.unicode.org/download/72 * https://cldr.unicode.org/index/downloads/cldr-42 * https://github.com/unicode-org/icu/pull/2103 --- tests/Rcmail/Rcmail.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Rcmail/Rcmail.php b/tests/Rcmail/Rcmail.php index 48879b3a7b0..4a16b38d40c 100644 --- a/tests/Rcmail/Rcmail.php +++ b/tests/Rcmail/Rcmail.php @@ -279,7 +279,14 @@ function test_format_date() $this->assertSame(' Mon', $rcmail->format_date($date, ' D')); $this->assertSame('D Monday', $rcmail->format_date($date, '\\D l')); $this->assertSame('Jun June', $rcmail->format_date($date, 'M F')); - $this->assertSame('6/1/20, 12:20 PM', $rcmail->format_date($date, 'x')); + $date_x = '6/1/20, 12:20 PM'; + if (defined('INTL_ICU_VERSION') + && version_compare(INTL_ICU_VERSION, '72.1', '>=')) { + // Starting with ICU 72.1, a NARROW NO-BREAK SPACE (NNBSP) + // is used instead of an ASCII space before the meridian. + $date_x = '6/1/20, 12:20 PM'; + } + $this->assertSame($date_x, $rcmail->format_date($date, 'x')); $this->assertSame('1591014030', $rcmail->format_date($date, 'U')); $this->assertSame('2020-06-01T12:20:30+00:00', $rcmail->format_date($date, 'c')); }