Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-02-02-18-36-16
[civicrm-core.git] / api / v3 / examples / Event / IsFullOption.php
1 <?php
2 /**
3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6 */
7
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 );
21
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;
38 }
39
40 /**
41 * Function returns array of result expected from previous function.
42 *
43 * @return array
44 * API result array
45 */
46 function event_getsingle_expectedresult() {
47
48 $expectedResult = array(
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 );
77
78 return $expectedResult;
79 }
80
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
86 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
87 *
88 * You can see the outcome of the API tests at
89 * https://test.civicrm.org/job/CiviCRM-master-git/
90 *
91 * To Learn about the API read
92 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
93 *
94 * Browse the api on your own site with the api explorer
95 * http://MYSITE.ORG/path/to/civicrm/api/explorer
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
102 */