}
}
- $tokens = [
- 'id',
- 'payment_instrument_id:label',
- 'financial_type_id:label',
- 'contribution_status_id:label',
- ];
- $legacyTokens = [];
- $realLegacyTokens = [];
- foreach (CRM_Core_SelectValues::contributionTokens() as $token => $label) {
- $legacyTokens[substr($token, 14, -1)] = $label;
- if (strpos($token, ':') === FALSE) {
- $realLegacyTokens[substr($token, 14, -1)] = $label;
- }
- }
$fields = (array) Contribution::getFields()->addSelect('name', 'title')->execute()->indexBy('name');
$allFields = [];
foreach ($fields as $field) {
}
// contact ID is skipped.
unset($allFields['contact_id']);
- $this->assertEquals($allFields, $realLegacyTokens);
+
$tokenProcessor = new TokenProcessor(\Civi::dispatcher(), [
'controller' => __CLASS__,
'smarty' => FALSE,
}
$comparison[substr($token, 14, -1)] = $label;
}
- $this->assertEquals($legacyTokens, $comparison);
- foreach ($tokens as $token) {
- $this->assertEquals(CRM_Core_SelectValues::contributionTokens()['{contribution.' . $token . '}'], $comparison[$token]);
- }
+ $this->assertEquals(
+ [
+ 'id' => 'Contribution ID',
+ 'financial_type_id:label' => 'Financial Type',
+ 'contribution_page_id:label' => 'Contribution Page',
+ 'payment_instrument_id:label' => 'Payment Method',
+ 'receive_date' => 'Date Received',
+ 'non_deductible_amount' => 'Non-deductible Amount',
+ 'total_amount' => 'Total Amount',
+ 'fee_amount' => 'Fee Amount',
+ 'net_amount' => 'Net Amount',
+ 'trxn_id' => 'Transaction ID',
+ 'invoice_id' => 'Invoice Reference',
+ 'invoice_number' => 'Invoice Number',
+ 'currency' => 'Currency',
+ 'cancel_date' => 'Cancelled / Refunded Date',
+ 'cancel_reason' => 'Cancellation / Refund Reason',
+ 'receipt_date' => 'Receipt Date',
+ 'thankyou_date' => 'Thank-you Date',
+ 'source' => 'Contribution Source',
+ 'amount_level' => 'Amount Label',
+ 'contribution_recur_id' => 'Recurring Contribution ID',
+ 'is_test:label' => 'Test',
+ 'is_pay_later:label' => 'Is Pay Later',
+ 'contribution_status_id:label' => 'Contribution Status',
+ 'address_id' => 'Address ID',
+ 'check_number' => 'Check Number',
+ 'campaign_id:label' => 'Campaign',
+ 'creditnote_id' => 'Credit Note ID',
+ 'tax_amount' => 'Tax Amount',
+ 'revenue_recognition_date' => 'Revenue Recognition Date',
+ 'is_template:label' => 'Is a Template Contribution',
+ 'paid_amount' => 'Amount Paid',
+ 'balance_amount' => 'Balance',
+ 'tax_exclusive_amount' => 'Tax Exclusive Amount',
+ ], $comparison);
}
/**