@@ -35,11 +35,11 @@ public function testConstructorDefaultTimeZone()
35
35
{
36
36
$ formatter = $ this ->getDateFormatter ('en ' , IntlDateFormatter::MEDIUM , IntlDateFormatter::SHORT );
37
37
38
- $ this ->assertEquals (date_default_timezone_get (), $ formatter ->getTimeZoneId ());
38
+ $ this ->assertSame (date_default_timezone_get (), $ formatter ->getTimeZoneId ());
39
39
40
- $ this ->assertEquals (
40
+ $ this ->assertSame (
41
41
$ this ->getDateTime (0 , $ formatter ->getTimeZoneId ())->format ('M j, Y, g:i A ' ),
42
- $ formatter ->format (0 )
42
+ str_replace ( "\u{202F}" , ' ' , $ formatter ->format (0 ) )
43
43
);
44
44
}
45
45
@@ -50,7 +50,7 @@ public function testConstructorWithoutDateType()
50
50
{
51
51
$ formatter = $ this ->getDateFormatter ('en ' , null , IntlDateFormatter::SHORT , 'UTC ' , IntlDateFormatter::GREGORIAN );
52
52
53
- $ this ->assertSame ('EEEE, MMMM d, y \'at \' h:mm a ' , $ formatter ->getPattern ());
53
+ $ this ->assertSame ('EEEE, MMMM d, y \'at \' h:mm a ' , str_replace ( "\u{202F}" , ' ' , $ formatter ->getPattern () ));
54
54
}
55
55
56
56
/**
@@ -60,7 +60,7 @@ public function testConstructorWithoutTimeType()
60
60
{
61
61
$ formatter = $ this ->getDateFormatter ('en ' , IntlDateFormatter::SHORT , null , 'UTC ' , IntlDateFormatter::GREGORIAN );
62
62
63
- $ this ->assertSame ('M/d/yy, h:mm:ss a zzzz ' , $ formatter ->getPattern ());
63
+ $ this ->assertSame ('M/d/yy, h:mm:ss a zzzz ' , str_replace ( "\u{202F}" , ' ' , $ formatter ->getPattern () ));
64
64
}
65
65
66
66
/**
@@ -498,7 +498,11 @@ public function testFormatIgnoresPatternForRelativeDateType()
498
498
$ datetime = \DateTime::createFromFormat ('U ' , time (), new \DateTimeZone ('GMT ' ));
499
499
$ datetime ->setTime (0 , 0 , 0 );
500
500
501
- $ this ->assertSame ('today at 12:00:00 AM Greenwich Mean Time ' , $ formatter ->format ($ datetime ));
501
+ $ formatted = $ formatter ->format ($ datetime );
502
+ $ formatted = str_replace (' at ' , ', ' , $ formatted );
503
+ $ formatted = str_replace ("\u{202F}" , ' ' , $ formatted );
504
+
505
+ $ this ->assertSame ('today, 12:00:00 AM Greenwich Mean Time ' , $ formatted );
502
506
}
503
507
504
508
/**
@@ -507,7 +511,7 @@ public function testFormatIgnoresPatternForRelativeDateType()
507
511
public function testDateAndTimeType ($ timestamp , $ datetype , $ timetype , $ expected )
508
512
{
509
513
$ formatter = $ this ->getDateFormatter ('en ' , $ datetype , $ timetype , 'UTC ' );
510
- $ this ->assertSame ($ expected , $ formatter ->format ($ timestamp ));
514
+ $ this ->assertSame ($ expected , str_replace ( "\u{202F}" , ' ' , $ formatter ->format ($ timestamp) ));
511
515
}
512
516
513
517
public static function dateAndTimeTypeProvider ()
@@ -533,7 +537,14 @@ public function testRelativeDateType($timestamp, $datetype, $timetype, $expected
533
537
$ datetime ->setTime (0 , 0 , 0 );
534
538
535
539
$ formatter = $ this ->getDateFormatter ('en ' , $ datetype , $ timetype , 'UTC ' );
536
- $ this ->assertSame ($ expected , $ formatter ->format ($ datetime ));
540
+
541
+ $ formatted = $ formatter ->format ($ datetime );
542
+
543
+ // Ignore differences that vary by version of PHP or ICU
544
+ $ formatted = str_replace (' at ' , ', ' , $ formatted );
545
+ $ formatted = str_replace ("\u{202F}" , ' ' , $ formatted );
546
+
547
+ $ this ->assertSame ($ expected , $ formatted );
537
548
}
538
549
539
550
public static function relativeDateTypeProvider ()
@@ -545,17 +556,17 @@ public static function relativeDateTypeProvider()
545
556
[0 , IntlDateFormatter::RELATIVE_SHORT , IntlDateFormatter::NONE , '1/1/70 ' ],
546
557
547
558
[time (), IntlDateFormatter::RELATIVE_FULL , IntlDateFormatter::NONE , 'today ' ],
548
- [time (), IntlDateFormatter::RELATIVE_LONG , IntlDateFormatter::FULL , 'today at 12:00:00 AM Coordinated Universal Time ' ],
559
+ [time (), IntlDateFormatter::RELATIVE_LONG , IntlDateFormatter::FULL , 'today, 12:00:00 AM Coordinated Universal Time ' ],
549
560
[time (), IntlDateFormatter::RELATIVE_MEDIUM , IntlDateFormatter::LONG , 'today, 12:00:00 AM UTC ' ],
550
561
[time (), IntlDateFormatter::RELATIVE_SHORT , IntlDateFormatter::SHORT , 'today, 12:00 AM ' ],
551
562
552
563
[strtotime ('-1 day ' , time ()), IntlDateFormatter::RELATIVE_FULL , IntlDateFormatter::NONE , 'yesterday ' ],
553
- [strtotime ('-1 day ' , time ()), IntlDateFormatter::RELATIVE_LONG , IntlDateFormatter::FULL , 'yesterday at 12:00:00 AM Coordinated Universal Time ' ],
564
+ [strtotime ('-1 day ' , time ()), IntlDateFormatter::RELATIVE_LONG , IntlDateFormatter::FULL , 'yesterday, 12:00:00 AM Coordinated Universal Time ' ],
554
565
[strtotime ('-1 day ' , time ()), IntlDateFormatter::RELATIVE_MEDIUM , IntlDateFormatter::LONG , 'yesterday, 12:00:00 AM UTC ' ],
555
566
[strtotime ('-1 day ' , time ()), IntlDateFormatter::RELATIVE_SHORT , IntlDateFormatter::SHORT , 'yesterday, 12:00 AM ' ],
556
567
557
568
[strtotime ('+1 day ' , time ()), IntlDateFormatter::RELATIVE_FULL , IntlDateFormatter::NONE , 'tomorrow ' ],
558
- [strtotime ('+1 day ' , time ()), IntlDateFormatter::RELATIVE_LONG , IntlDateFormatter::FULL , 'tomorrow at 12:00:00 AM Coordinated Universal Time ' ],
569
+ [strtotime ('+1 day ' , time ()), IntlDateFormatter::RELATIVE_LONG , IntlDateFormatter::FULL , 'tomorrow, 12:00:00 AM Coordinated Universal Time ' ],
559
570
[strtotime ('+1 day ' , time ()), IntlDateFormatter::RELATIVE_MEDIUM , IntlDateFormatter::LONG , 'tomorrow, 12:00:00 AM UTC ' ],
560
571
[strtotime ('+1 day ' , time ()), IntlDateFormatter::RELATIVE_SHORT , IntlDateFormatter::SHORT , 'tomorrow, 12:00 AM ' ],
561
572
];
0 commit comments