Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#2745 - Contribution Tokens - Load all API fields #21145

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dev/core#2747 Add listening & test for contribution tokens processor
  • Loading branch information
eileenmcnaughton authored and totten committed Aug 15, 2021
commit 653afd67d20226fe572897a0e917779a501cabca
16 changes: 16 additions & 0 deletions tests/phpunit/CRM/Contribute/ActionMapping/ByTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

use Civi\Api4\Contribution;
use Civi\Token\TokenProcessor;

/**
* Class CRM_Contribute_ActionMapping_ByTypeTest
Expand Down Expand Up @@ -319,6 +320,21 @@ public function testTokenRendering(): void {
];
$this->mut->checkMailLog($expected);

$tokenProcessor = new TokenProcessor(\Civi::dispatcher(), [
'controller' => get_class(),
'smarty' => FALSE,
'contributionId' => $this->ids['Contribution']['alice'],
'contactId' => $this->contacts['alice']['id'],
]);
$tokenProcessor->addRow([]);
$tokenProcessor->addMessage('html', $this->schedule->body_text, 'text/plain');
$tokenProcessor->evaluate();
foreach ($tokenProcessor->getRows() as $row) {
foreach ($expected as $value) {
$this->assertStringContainsString($value, $row->render('html'));
}
}

$messageToken = CRM_Utils_Token::getTokens($this->schedule->body_text);

$contributionDetails = CRM_Contribute_BAO_Contribution::replaceContributionTokens(
Expand Down