Skip to content

Commit

Permalink
(NFC) TokenConsistencyTest - Small tweaks
Browse files Browse the repository at this point in the history
1. You don't need to call evaluate() twice. It should be once after filling both rows+messages.
2. Add messages to clarify assertions
  • Loading branch information
totten committed Oct 8, 2021
1 parent d49e8ee commit 0bb1824
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/phpunit/CRM/Utils/TokenConsistencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ public function testOddTokens(): void {
]);
$contactID = $this->individualCreate(['middle_name' => '']);
$tokenProcessor->addRow(['contactId' => $contactID]);
$tokenProcessor->evaluate();
foreach ($variants as $index => $variant) {
$tokenProcessor->addMessage($index, $variant['string'], 'text/plain');
}
Expand All @@ -268,8 +267,8 @@ public function testOddTokens(): void {
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');
}
}

Expand Down

0 comments on commit 0bb1824

Please sign in to comment.