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