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