Skip to content

Commit 2259091

Browse files
committed
Fix timestamp test
1 parent 400cf9a commit 2259091

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,29 @@ class TimestampableElementProviderTest extends WebTestCase
5959
protected function setUp(): void
6060
{
6161
self::bootKernel();
62-
\Locale::setDefault('en');
62+
\Locale::setDefault('en_US');
6363
$this->service = self::getContainer()->get(TimestampableElementProvider::class);
64-
$this->target = new class() implements TimeStampableInterface {
64+
$this->target = new class () implements TimeStampableInterface {
6565
public function getLastModified(): ?DateTime
6666
{
67-
return new \DateTime('2000-01-01');
67+
return new DateTime('2000-01-01');
6868
}
6969

7070
public function getAddedDate(): ?DateTime
7171
{
72-
return new \DateTime('2000-01-01');
72+
return new DateTime('2000-01-01');
7373
}
7474
};
7575
}
7676

7777
public function dataProvider(): \Iterator
7878
{
79-
\Locale::setDefault('en');
80-
yield ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'];
81-
yield ['1/1/00, 12:00 AM', '[[CREATION_DATE]]'];
79+
\Locale::setDefault('en_US');
80+
// Use IntlDateFormatter like the actual service does
81+
$formatter = new \IntlDateFormatter(\Locale::getDefault(), \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
82+
$expectedFormat = $formatter->format(new DateTime('2000-01-01'));
83+
yield [$expectedFormat, '[[LAST_MODIFIED]]'];
84+
yield [$expectedFormat, '[[CREATION_DATE]]'];
8285
}
8386

8487
/**

0 commit comments

Comments
 (0)