* @deprecated
*/
public static function getMembershipTokenDetails($membershipIDs) {
+ CRM_Core_Error::deprecatedFunctionWarning('token processor');
$memberships = civicrm_api3('membership', 'get', [
'options' => ['limit' => 0],
'membership_id' => ['IN' => (array) $membershipIDs],
* string with replacements made
*/
public static function replaceEntityTokens($entity, $entityArray, $str, $knownTokens = [], $escapeSmarty = FALSE) {
+ CRM_Core_Error::deprecatedFunctionWarning('token processor');
if (!$knownTokens || empty($knownTokens[$entity])) {
return $str;
}
$this->restoreMembershipTypes();
$this->createCustomGroupWithFieldOfType(['extends' => 'Membership']);
$expectedTokens = $this->getMembershipTokens();
+ // This get also creates...
+ $this->getMembershipID();
$newStyleTokens = "\n{membership.status_id:label}\n{membership.membership_type_id:label}\n";
$tokenString = $newStyleTokens . implode("\n", array_keys($this->getMembershipTokens()));
- $memberships = CRM_Utils_Token::getMembershipTokenDetails([$this->getMembershipID()]);
- $messageToken = CRM_Utils_Token::getTokens($tokenString);
- $tokenHtml = CRM_Utils_Token::replaceEntityTokens('membership', $memberships[$this->getMembershipID()], $tokenString, $messageToken);
- $this->assertEquals($this->getExpectedMembershipTokenOutput(), $tokenHtml);
-
// Custom fields work in the processor so test it....
$tokenString .= "\n{membership." . $this->getCustomFieldName('text') . '}';
// Now compare with scheduled reminder
$mut = new CiviMailUtils($this);
CRM_Utils_Time::setTime('2007-01-22 15:00:00');
- $this->callAPISuccess('action_schedule', 'create', [
+ $this->callAPISuccess('ActionSchedule', 'create', [
'title' => 'job',
'subject' => 'job',
'entity_value' => 1,
'start_action_unit' => 'day',
'body_html' => $tokenString,
]);
- $this->callAPISuccess('job', 'send_reminder', []);
+ $this->callAPISuccess('Job', 'send_reminder', []);
$expected = $this->getExpectedMembershipTokenOutput();
// Unlike the legacy method custom fields are resolved by the processor.
$expected .= "\nmy field";