diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index e77244bef1f0..df8ece444cc8 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -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 = [ diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index db2829ef08e5..b5d6739186d7 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -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); } } diff --git a/tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php b/tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php index 782874b2bf0b..683ed6035c36 100644 --- a/tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php +++ b/tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php @@ -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', @@ -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']); + } /** diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 957a716325a7..1343cffa1b42 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -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); diff --git a/tests/phpunit/api/v3/PaymentTest.php b/tests/phpunit/api/v3/PaymentTest.php index 6395c462a984..8f0bf927e0f1 100644 --- a/tests/phpunit/api/v3/PaymentTest.php +++ b/tests/phpunit/api/v3/PaymentTest.php @@ -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.',