Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using participant get API | |
4 | * * | |
6a488035 TO |
5 | */ |
6 | function participant_get_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 | 8 | 'id' => 1, |
6a488035 TO |
9 | ); |
10 | ||
fb32de45 | 11 | try{ |
12 | $result = civicrm_api3('participant', 'get', $params); | |
13 | } | |
14 | catch (CiviCRM_API3_Exception $e) { | |
15 | // handle error here | |
16 | $errorMessage = $e->getMessage(); | |
17 | $errorCode = $e->getErrorCode(); | |
18 | $errorData = $e->getExtraParams(); | |
19 | return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); | |
20 | } | |
6a488035 | 21 | |
fb32de45 | 22 | return $result; |
6a488035 TO |
23 | } |
24 | ||
fb32de45 | 25 | /** |
6a488035 TO |
26 | * Function returns array of result expected from previous function |
27 | */ | |
28 | function participant_get_expectedresult(){ | |
29 | ||
53ca8fd7 | 30 | $expectedResult = array( |
6a488035 TO |
31 | 'is_error' => 0, |
32 | 'version' => 3, | |
33 | 'count' => 1, | |
34 | 'id' => 1, | |
53ca8fd7 | 35 | 'values' => array( |
36 | '1' => array( | |
6a488035 TO |
37 | 'contact_id' => '2', |
38 | 'contact_type' => 'Individual', | |
39 | 'contact_sub_type' => '', | |
40 | 'sort_name' => 'Anderson, Anthony', | |
41 | 'display_name' => 'Mr. Anthony Anderson II', | |
42 | 'event_id' => '5', | |
43 | 'event_title' => 'Annual CiviCRM meet', | |
9f1b81e0 | 44 | 'event_start_date' => '2013-07-29 00:00:00', |
45 | 'event_end_date' => '2013-08-04 00:00:00', | |
6a488035 TO |
46 | 'participant_id' => '1', |
47 | 'participant_fee_level' => '', | |
48 | 'participant_fee_amount' => '', | |
49 | 'participant_fee_currency' => '', | |
50 | 'event_type' => 'Conference', | |
51 | 'participant_status_id' => '2', | |
52 | 'participant_status' => 'Attended', | |
53 | 'participant_role_id' => '1', | |
54 | 'participant_register_date' => '2007-02-19 00:00:00', | |
55 | 'participant_source' => 'Wimbeldon', | |
56 | 'participant_note' => '', | |
57 | 'participant_is_pay_later' => 0, | |
58 | 'participant_is_test' => 0, | |
59 | 'participant_registered_by_id' => '', | |
60 | 'participant_discount_name' => '', | |
61 | 'participant_campaign_id' => '', | |
62 | 'id' => '1', | |
63 | ), | |
64 | ), | |
65 | ); | |
66 | ||
fb32de45 | 67 | return $expectedResult; |
6a488035 TO |
68 | } |
69 | ||
70 | ||
71 | /* | |
72 | * This example has been generated from the API test suite. The test that created it is called | |
73 | * | |
74 | * testGetParamsAsIdOnly and can be found in | |
75 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ParticipantTest.php | |
76 | * | |
77 | * You can see the outcome of the API tests at | |
78 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
79 | * | |
80 | * To Learn about the API read | |
81 | * http://book.civicrm.org/developer/current/techniques/api/ | |
82 | * | |
83 | * and review the wiki at | |
84 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
85 | * | |
86 | * Read more about testing here | |
87 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
88 | * | |
89 | * API Standards documentation: | |
90 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
91 | */ |