Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
50fb255d | 3 | * @file |
4 | * Test Generated API Example. | |
5 | * See bottom of this file for more detail. | |
6a488035 | 6 | */ |
6a488035 | 7 | |
50fb255d | 8 | /** |
9 | * Test Generated example of using event getsingle API. | |
10 | * | |
11 | * demonstrates use of return is_full | |
12 | * | |
13 | * @return array | |
14 | * API result array | |
15 | */ | |
16 | function event_getsingle_example() { | |
17 | $params = array( | |
18 | 'id' => 1, | |
19 | 'return.is_full' => 1, | |
20 | ); | |
6a488035 | 21 | |
50fb255d | 22 | try{ |
23 | $result = civicrm_api3('event', 'getsingle', $params); | |
24 | } | |
25 | catch (CiviCRM_API3_Exception $e) { | |
26 | // Handle error here. | |
27 | $errorMessage = $e->getMessage(); | |
28 | $errorCode = $e->getErrorCode(); | |
29 | $errorData = $e->getExtraParams(); | |
30 | return array( | |
31 | 'error' => $errorMessage, | |
32 | 'error_code' => $errorCode, | |
33 | 'error_data' => $errorData, | |
34 | ); | |
35 | } | |
36 | ||
37 | return $result; | |
6a488035 TO |
38 | } |
39 | ||
fb32de45 | 40 | /** |
50fb255d | 41 | * Function returns array of result expected from previous function. |
42 | * | |
43 | * @return array | |
44 | * API result array | |
6a488035 | 45 | */ |
50fb255d | 46 | function event_getsingle_expectedresult() { |
6a488035 | 47 | |
53ca8fd7 | 48 | $expectedResult = array( |
50fb255d | 49 | 'id' => '1', |
50 | 'title' => 'Annual CiviCRM meet', | |
51 | 'event_title' => 'Annual CiviCRM meet', | |
52 | 'event_type_id' => '1', | |
53 | 'participant_listing_id' => 0, | |
54 | 'is_public' => '1', | |
55 | 'start_date' => '2008-10-21 00:00:00', | |
56 | 'event_start_date' => '2008-10-21 00:00:00', | |
57 | 'is_online_registration' => 0, | |
58 | 'max_participants' => '1', | |
59 | 'is_monetary' => 0, | |
60 | 'is_map' => 0, | |
61 | 'is_active' => '1', | |
62 | 'is_show_location' => '1', | |
63 | 'default_role_id' => '1', | |
64 | 'is_email_confirm' => 0, | |
65 | 'is_pay_later' => 0, | |
66 | 'is_partial_payment' => 0, | |
67 | 'is_multiple_registrations' => 0, | |
68 | 'allow_same_participant_emails' => 0, | |
69 | 'is_template' => 0, | |
70 | 'created_date' => '2015-01-15 02:10:12', | |
71 | 'is_share' => '1', | |
72 | 'is_confirm_enabled' => '1', | |
73 | 'is_billing_required' => 0, | |
74 | 'available_places' => 0, | |
75 | 'is_full' => '1', | |
76 | ); | |
6a488035 | 77 | |
fb32de45 | 78 | return $expectedResult; |
6a488035 TO |
79 | } |
80 | ||
50fb255d | 81 | /** |
82 | * This example has been generated from the API test suite. | |
83 | * The test that created it is called | |
84 | * testGetSingleReturnIsFull | |
85 | * and can be found in | |
69d79249 | 86 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php |
6a488035 TO |
87 | * |
88 | * You can see the outcome of the API tests at | |
69d79249 | 89 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
6a488035 TO |
90 | * |
91 | * To Learn about the API read | |
69d79249 | 92 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
6a488035 | 93 | * |
69d79249 E |
94 | * Browse the api on your own site with the api explorer |
95 | * http://MYSITE.ORG/path/to/civicrm/api/explorer | |
6a488035 TO |
96 | * |
97 | * Read more about testing here | |
98 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
99 | * | |
100 | * API Standards documentation: | |
101 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 102 | */ |