@@ -1466,6 +1466,8 @@ public function testProcessOnBehalfOrganization() {
14661466 * This function tests whether the contribution tokens are replaced with values from contribution.
14671467 */
14681468 public function testReplaceContributionTokens () {
1469+ $ customGroup = $ this ->customGroupCreate (['extends ' => 'Contribution ' , 'title ' => 'contribution stuff ' ]);
1470+ $ customField = $ this ->customFieldOptionValueCreate ($ customGroup , 'myCustomField ' );
14691471 $ contactId1 = $ this ->individualCreate ();
14701472 $ params = array (
14711473 'contact_id ' => $ contactId1 ,
@@ -1476,6 +1478,7 @@ public function testReplaceContributionTokens() {
14761478 'invoice_id ' => 67890 ,
14771479 'source ' => 'SSF ' ,
14781480 'contribution_status_id ' => 2 ,
1481+ "custom_ {$ customField ['id ' ]}" => 'value1 ' ,
14791482 );
14801483 $ contribution1 = $ this ->contributionCreate ($ params );
14811484 $ contactId2 = $ this ->individualCreate ();
@@ -1488,6 +1491,7 @@ public function testReplaceContributionTokens() {
14881491 'invoice_id ' => 12345 ,
14891492 'source ' => 'ABC ' ,
14901493 'contribution_status_id ' => 1 ,
1494+ "custom_ {$ customField ['id ' ]}" => 'value2 ' ,
14911495 );
14921496 $ contribution2 = $ this ->contributionCreate ($ params );
14931497 $ ids = array ($ contribution1 , $ contribution2 );
@@ -1496,7 +1500,8 @@ public function testReplaceContributionTokens() {
14961500 $ text = "Contribution Amount: {contribution.total_amount} " ;
14971501 $ html = "<p>Contribution Source: {contribution.contribution_source}</p></br>
14981502 <p>Contribution Invoice ID: {contribution.invoice_id}</p></br>
1499- <p>Contribution Receive Date: {contribution.receive_date}</p></br> " ;
1503+ <p>Contribution Receive Date: {contribution.receive_date}</p></br>
1504+ <p>Contribution Custom Field: {contribution.custom_ {$ customField ['id ' ]}}</p></br> " ;
15001505
15011506 $ subjectToken = CRM_Utils_Token::getTokens ($ subject );
15021507 $ messageToken = CRM_Utils_Token::getTokens ($ text );
@@ -1515,7 +1520,8 @@ public function testReplaceContributionTokens() {
15151520 $ this ->assertEquals ("Contribution Amount: $ 100.00 " , $ contributionDetails [$ contactId1 ]['text ' ], "The text does not match " );
15161521 $ this ->assertEquals ("<p>Contribution Source: ABC</p></br>
15171522 <p>Contribution Invoice ID: 12345</p></br>
1518- <p>Contribution Receive Date: May 11th, 2015</p></br> " , $ contributionDetails [$ contactId2 ]['html ' ], "The html does not match " );
1523+ <p>Contribution Receive Date: May 11th, 2015</p></br>
1524+ <p>Contribution Custom Field: Label2</p></br> " , $ contributionDetails [$ contactId2 ]['html ' ], "The html does not match " );
15191525 }
15201526
15211527 /**
0 commit comments