Skip to content

Commit

Permalink
Merge pull request #15010 from eileenmcnaughton/event_inv
Browse files Browse the repository at this point in the history
Event confirm - (very) minor cleanup + test
  • Loading branch information
eileenmcnaughton authored Aug 10, 2019
2 parents d2c5a25 + 1604fa9 commit f39da48
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CRM/Event/BAO/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ public static function usesPriceSet($id) {
* @return array|null
* @throws \CiviCRM_API3_Exception
*/
public static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) {
public static function sendMail($contactID, $values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) {

$template = CRM_Core_Smarty::singleton();
$gIds = [
Expand Down
1 change: 0 additions & 1 deletion CRM/Event/Form/Registration/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ public function postProcess() {

//send mail to primary as well as additional participants.
$this->assign('contactID', $contactId);
$this->assign('participantID', $participantID);
CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
Expand Down
11 changes: 10 additions & 1 deletion tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function setUp() {
*/
public function testSubmit() {
$event = $this->eventCreate();
$mut = new CiviMailUtils($this, TRUE);
CRM_Event_Form_Registration_Confirm::testSubmit([
'id' => $event['id'],
'contributeMode' => 'direct',
Expand Down Expand Up @@ -77,7 +78,15 @@ public function testSubmit() {
],
],
]);
$this->callAPISuccessGetSingle('Participant', []);
$participant = $this->callAPISuccessGetSingle('Participant', []);
$mut->checkMailLog([
'Dear Logged In, Thank you for your participation. This letter is a confirmation that your registration has been received and your status has been updated to Registered.',
]);
$mut->stop();
$mut->clearMessages();
$tplVars = CRM_Core_Smarty::singleton()->get_template_vars();
$this->assertEquals($participant['id'], $tplVars['participantID']);

}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ public function eventCreate($params = array()) {
'is_monetary' => 0,
'is_active' => 1,
'is_show_location' => 0,
'is_email_confirm' => 1,
), $params);

return $this->callAPISuccess('Event', 'create', $params);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/api/v3/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function testPaymentEmailReceiptFullyPaid() {
$payment = $this->callAPISuccess('payment', 'create', $params);

$this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
$mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet']);
$mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet', 'Registration Confirmation - Annual CiviCRM meet']);
$mut->checkMailLog([
'Dear Anthony,',
'A payment has been received.',
Expand Down

0 comments on commit f39da48

Please sign in to comment.