Merge pull request #5216 from atif-shaikh/CRM-15792
[civicrm-core.git] / api / v3 / examples / Event / IsFullOption.php
CommitLineData
6a488035 1<?php
50fb255d 2/**
a828d7b8 3 * Test Generated example demonstrating the Event.getsingle API.
50fb255d 4 *
5c49fee0 5 * Demonstrates use of return is_full .
50fb255d 6 *
7 * @return array
8 * API result array
9 */
10function event_getsingle_example() {
11 $params = array(
12 'id' => 1,
13 'return.is_full' => 1,
14 );
6a488035 15
50fb255d 16 try{
a828d7b8 17 $result = civicrm_api3('Event', 'getsingle', $params);
50fb255d 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 40function 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,
a828d7b8 64 'created_date' => '2015-02-22 23:13:11',
50fb255d 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
a828d7b8 75/*
50fb255d 76* This example has been generated from the API test suite.
a828d7b8
CW
77* The test that created it is called "testGetSingleReturnIsFull"
78* and can be found at:
69d79249 79* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
6a488035
TO
80*
81* You can see the outcome of the API tests at
69d79249 82* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
83*
84* To Learn about the API read
69d79249 85* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 86*
69d79249 87* Browse the api on your own site with the api explorer
41d4d31f 88* http://MYSITE.ORG/path/to/civicrm/api
6a488035
TO
89*
90* Read more about testing here
91* http://wiki.civicrm.org/confluence/display/CRM/Testing
92*
93* API Standards documentation:
94* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 95*/