* messages
* @throws \CRM_Core_Exception
*/
- public function composeMessageArray(&$input, &$ids, &$values, $returnMessageText = TRUE) {
+ public function composeMessageArray($input, $ids, $values = [], $returnMessageText = TRUE) {
$ids = array_merge(self::getComponentDetails($this->id), $ids);
if (empty($ids['contact']) && isset($this->contact_id)) {
$ids['contact'] = $this->contact_id;
}
-
- if (empty($this->_component)) {
- if (!empty($ids['event'])) {
- $this->_component = 'event';
- }
- else {
- $this->_component = $input['component'] ?? 'contribute';
- }
+ if (!empty($ids['event'])) {
+ $this->_component = 'event';
+ }
+ else {
+ $this->_component = 'contribute';
}
- // @todo remove strtolower - check consistency
- $this->_component = strtolower($this->_component);
// If the object is not fully populated then make sure it is - this is a more about legacy paths & cautious
// refactoring than anything else, and has unit test coverage.
$this->_setUpMembershipObjects();
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
- $values = [];
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertIsArray($msg, 'Message returned as an array in line');
$this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
$this->assertStringContainsString('Membership Type: General', $msg['body']);
public function testSendMailMembershipObjectsNoLeakage(): void {
$this->_setUpMembershipObjects();
$contribution = new CRM_Contribute_BAO_Contribution();
- $values = [];
$contribution->id = $this->_contributionId;
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
$this->assertStringContainsString('Membership Type: General', $msg['body']);
$this->input['invoiceID'] = 'abc';
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertEquals('Dr. Donald Duck II', $msg['to']);
$this->assertStringContainsString('Membership Type: Fowl', $msg['body']);
}
$this->_setUpMembershipObjects();
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertIsArray($msg, 'Message not returned as an array');
$this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
$this->assertStringContainsString('Membership Type: General', $msg['body']);
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
$contribution->loadRelatedObjects($this->_processorId, $this->ids);
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertStringContainsString('registration has been received and your status has been updated to Attended.', $msg['body']);
$this->assertStringContainsString('Annual CiviCRM meet', $msg['html']);
}
$this->_setUpParticipantObjects();
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertEquals('Mr. Anthony Anderson II', $msg['to']);
$this->assertStringContainsString('Thank you for your registration', $msg['body']);
}
$event->id = $this->_eventId;
$event->is_email_confirm = FALSE;
$event->save();
- $values = [];
$tablesToTruncate = [
'civicrm_mailing_spool',
];
$mut = new CiviMailUtils($this, TRUE);
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
- $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $contribution->composeMessageArray($this->input, $this->ids);
$mut->assertMailLogEmpty('no mail should have been send as event set to no confirm');
$mut->stop();
}
$this->_setUpPledgeObjects();
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $this->_contributionId;
- $msg = $contribution->composeMessageArray($this->input, $this->ids, $values);
+ $msg = $contribution->composeMessageArray($this->input, $this->ids);
$this->assertStringContainsString('Contribution Information', $msg['html']);
}