From 9c7c91f4f6512c87462d4f0a52bae7e70afbbfb7 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 21 Sep 2021 23:48:46 -0700 Subject: [PATCH] (NFC) TokenProcessorTest - When formatting dates, month and day names should be localized --- tests/phpunit/Civi/Token/TokenProcessorTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/Civi/Token/TokenProcessorTest.php b/tests/phpunit/Civi/Token/TokenProcessorTest.php index 3c9890c420..4b2b4ebb51 100644 --- a/tests/phpunit/Civi/Token/TokenProcessorTest.php +++ b/tests/phpunit/Civi/Token/TokenProcessorTest.php @@ -171,20 +171,23 @@ class TokenProcessorTest extends \CiviUnitTestCase { } public function testRenderLocalizedSmarty() { + \CRM_Utils_Time::setTime('2022-04-08 16:32:04'); + $resetTime = \CRM_Utils_AutoClean::with(['CRM_Utils_Time', 'resetTime']); + $this->dispatcher->addSubscriber(new \CRM_Core_DomainTokens()); $this->dispatcher->addSubscriber(new TokenCompatSubscriber()); $p = new TokenProcessor($this->dispatcher, [ 'controller' => __CLASS__, 'smarty' => TRUE, ]); - $p->addMessage('text', '{ts}Yes{/ts} {ts}No{/ts}', 'text/plain'); + $p->addMessage('text', '{ts}Yes{/ts} {ts}No{/ts} {domain.now|crmDate:"%B"}', 'text/plain'); $p->addRow([]); $p->addRow(['locale' => 'fr_FR']); $p->addRow(['locale' => 'es_MX']); $expectText = [ - 'Yes No', - 'Oui Non', - 'Sí No', + 'Yes No April', + 'Oui Non Avril', + 'Sí No Abril', ]; $rowCount = 0; -- 2.25.1