Merge pull request #1199 from totten/master-premature-commit
[civicrm-core.git] / tests / phpunit / CiviTest / Participant.php
CommitLineData
6a488035
TO
1<?php
2class Participant extends PHPUnit_Framework_Testcase {
3 /**
4 * Helper function to create a Participant
5 *
6 * @return $participant id of created Participant
7 */
8 static function create($contactId, $eventId) {
9 $params = array(
10 'send_receipt' => 1,
11 'is_test' => 0,
12 'is_pay_later' => 0,
13 'event_id' => $eventId,
14 'register_date' => date('Y-m-d') . " 00:00:00",
15 'role_id' => 1,
16 'status_id' => 1,
17 'source' => 'Event_' . $eventId,
18 'contact_id' => $contactId,
19 );
20
21 require_once 'CRM/Event/BAO/Participant.php';
22 $participant = CRM_Event_BAO_Participant::add($params);
23 return $participant->id;
24 }
25
26 /**
27 * Helper function to delete a participant
28 *
29 * @param int $participantID id of the participant to delete
30 * @return boolean true if participant deleted, false otherwise
31 */
32 static function delete($participantId) {
33 require_once 'CRM/Event/BAO/Participant.php';
34 return CRM_Event_BAO_Participant::deleteParticipant($participantId);
35 }
36}