From 7f21e087674ad2f062b46b8ff86dc80d81532bb8 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 8 Sep 2023 09:45:39 +1200 Subject: [PATCH] Add test for participant role, check mail --- CRM/Event/Form/Participant.php | 2 +- tests/phpunit/CRM/Event/Form/ParticipantTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index bb37902b77..63f6a5628f 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -151,7 +151,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment * * @var string */ - public $_mode = NULL; + public $_mode; /** * Event ID preselect. diff --git a/tests/phpunit/CRM/Event/Form/ParticipantTest.php b/tests/phpunit/CRM/Event/Form/ParticipantTest.php index 6c2fe8f3b6..84eefb9dce 100644 --- a/tests/phpunit/CRM/Event/Form/ParticipantTest.php +++ b/tests/phpunit/CRM/Event/Form/ParticipantTest.php @@ -43,6 +43,20 @@ class CRM_Event_Form_ParticipantTest extends CiviUnitTestCase { $this->callAPISuccessGetSingle('Participant', ['id' => $form->getParticipantID()]); } + public function testSubmitDualRole(): void { + $email = $this->getForm([], [ + 'status_id' => 1, + 'register_date' => date('Ymd'), + 'send_receipt' => 1, + 'from_email_address' => 'admin@email.com', + 'role_id' => [ + CRM_Core_PseudoConstant::getKey('CRM_Event_BAO_Participant', 'role_id', 'Volunteer'), + CRM_Core_PseudoConstant::getKey('CRM_Event_BAO_Participant', 'role_id', 'Speaker'), + ], + ])->postProcess()->getFirstMailBody(); + $this->assertStringContainsString('Volunteer, Speaker', $email); + } + /** * Test financial items pending transaction is later altered. * -- 2.25.1