From 0bb18246a40058b42684fc5fbd23357a8623ecd3 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 7 Oct 2021 22:54:51 -0700 Subject: [PATCH] (NFC) TokenConsistencyTest - Small tweaks 1. You don't need to call evaluate() twice. It should be once after filling both rows+messages. 2. Add messages to clarify assertions --- tests/phpunit/CRM/Utils/TokenConsistencyTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php index 7e7f00c1f1..e5878ab784 100644 --- a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php +++ b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php @@ -259,7 +259,6 @@ case.custom_1 :' . ' ]); $contactID = $this->individualCreate(['middle_name' => '']); $tokenProcessor->addRow(['contactId' => $contactID]); - $tokenProcessor->evaluate(); foreach ($variants as $index => $variant) { $tokenProcessor->addMessage($index, $variant['string'], 'text/plain'); } @@ -268,8 +267,8 @@ case.custom_1 :' . ' foreach ($variants as $index => $variant) { $greetingString = $variant['string']; CRM_Utils_Token::replaceGreetingTokens($greetingString, $this->callAPISuccessGetSingle('Contact', ['id' => $contactID]), $contactID); - $this->assertEquals($variant['expected'], $greetingString); - $this->assertEquals($variant['expected'], $result->render($index)); + $this->assertEquals($variant['expected'], $greetingString, 'replaceGreetingTokens() should render expected output'); + $this->assertEquals($variant['expected'], $result->render($index), 'TokenProcessor should render expected output'); } } -- 2.25.1