fixes event#63: Don't crash scheduled reminders when participant has > 1 role ID
[civicrm-core.git] / tests / phpunit / CRM / Event / ActionMappingTest.php
CommitLineData
aaae95ea
JG
1<?php
2/*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12/**
13 * Class CRM_Event_ActionMappingTest
14 * @group ActionSchedule
15 *
16 * This class tests various configurations of event scheduled-reminders. It follows a design/pattern described in
17 * AbstractMappingTest.
18 *
19 * @see \Civi\ActionSchedule\AbstractMappingTest
20 * @group headless
21 */
22class CRM_Event_ActionMappingTest extends \Civi\ActionSchedule\AbstractMappingTest {
23
24 public function createTestCases() {
25 }
26
27 public function testLimitByRoleId() {
28 $participantId = $this->participantCreate(['role_id' => [1, 2]]);
29 $participant = $this->callAPISuccess('participant', 'getsingle', ['id' => $participantId]);
30 $eventId = $participant['event_id'];
31 $this->schedule->mapping_id = CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID;
32 $this->schedule->start_action_date = 'start_date';
33 $this->schedule->entity_value = $eventId;
34 $this->schedule->limit_to = 1;
35 $this->schedule->recipient_listing = 1;
36 $this->startWeekBefore();
37 $this->useHelloFirstName();
38 $this->schedule->save();
39 $this->callAPISuccess('job', 'send_reminder', []);
40 }
41
42}