Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event confirm - (very) minor cleanup + test #15010

Merged
merged 2 commits into from
Aug 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Event/BAO/Event.php
Original file line number Diff line number Diff line change
@@ -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 = [
1 change: 0 additions & 1 deletion CRM/Event/Form/Registration/Confirm.php
Original file line number Diff line number Diff line change
@@ -928,7 +928,6 @@ public function postProcess() {

//send mail to primary as well as additional participants.
$this->assign('contactID', $contactId);
$this->assign('participantID', $participantID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton is the participantID field exposed on any confirm step or thank you step form or is this assign just about the smarty email template?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah after this line the only remaining thing that happens is calling sendEmail + it iterates through multiple participantIDs so it would be the 'last one'

CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
11 changes: 10 additions & 1 deletion tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php
Original file line number Diff line number Diff line change
@@ -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']);

}

/**
1 change: 1 addition & 0 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion tests/phpunit/api/v3/PaymentTest.php
Original file line number Diff line number Diff line change
@@ -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.',