$this->set('participantInfo', $participantInfo);
}
- if ($this->getPaymentProcessorObject()->supports('noReturn')
+ if (!$this->getEventValue('is_monetary') || $this->getPaymentProcessorObject()->supports('noReturn')
) {
// Send mail Confirmation/Receipt.
$this->sendMails($params, $registerByID, $participantCount);
* @param int $mailIndex
*/
protected function assertMailSentContainingString(string $string, int $mailIndex = 0): void {
+ if (!$this->form->getMail()) {
+ $this->fail('No mail sent');
+ }
$mail = $this->form->getMail()[$mailIndex];
$this->assertStringContainsString(preg_replace('/\s+/', '', $string), preg_replace('/\s+/', '', $mail['body']), 'String not found: ' . $string . "\n" . $mail['body']);
}
$this->sentMail = $mailUtil->getAllMessages();
}
+ /**
+ * Ensure an email is sent when confirm is disabled for unpaid events.
+ */
+ public function testSubmitUnpaidEventNoConfirm(): void {
+ $this->eventCreateUnpaid(['is_confirm_enabled' => FALSE]);
+ $form = $this->getTestForm('CRM_Event_Form_Registration_Register', [
+ 'email-Primary' => 'demo@example.com',
+ ], ['id' => $this->getEventID()]);
+ $form->processForm();
+ $this->assertMailSentContainingStrings(['Event']);
+ }
+
public function testRegistrationWithoutCiviContributeEnabled(): void {
$mut = new CiviMailUtils($this, TRUE);
$event = $this->eventCreateUnpaid([