Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
aba1cd8b EM |
2 | |
3 | /** | |
4 | * Class Participant | |
5 | */ | |
6a488035 TO |
6 | class Participant extends PHPUnit_Framework_Testcase { |
7 | /** | |
eceb18cc | 8 | * Helper function to create a Participant. |
6a488035 | 9 | * |
100fef9d CW |
10 | * @param int $contactId |
11 | * @param int $eventId | |
2a6da8d7 | 12 | * |
72b3a70c CW |
13 | * @return int |
14 | * id of created Participant | |
6a488035 | 15 | */ |
00be9182 | 16 | public static function create($contactId, $eventId) { |
6a488035 TO |
17 | $params = array( |
18 | 'send_receipt' => 1, | |
19 | 'is_test' => 0, | |
20 | 'is_pay_later' => 0, | |
21 | 'event_id' => $eventId, | |
22 | 'register_date' => date('Y-m-d') . " 00:00:00", | |
23 | 'role_id' => 1, | |
24 | 'status_id' => 1, | |
25 | 'source' => 'Event_' . $eventId, | |
26 | 'contact_id' => $contactId, | |
27 | ); | |
28 | ||
29 | require_once 'CRM/Event/BAO/Participant.php'; | |
30 | $participant = CRM_Event_BAO_Participant::add($params); | |
31 | return $participant->id; | |
32 | } | |
33 | ||
34 | /** | |
eceb18cc | 35 | * Helper function to delete a participant. |
6a488035 | 36 | * |
c490a46a | 37 | * @param int $participantId |
3bdca100 | 38 | * @return bool |
a6c01b45 | 39 | * true if participant deleted, false otherwise |
6a488035 | 40 | */ |
00be9182 | 41 | public static function delete($participantId) { |
6a488035 TO |
42 | require_once 'CRM/Event/BAO/Participant.php'; |
43 | return CRM_Event_BAO_Participant::deleteParticipant($participantId); | |
44 | } | |
96025800 | 45 | |
6a488035 | 46 | } |