test tweaks and updated examples
[civicrm-core.git] / api / v3 / examples / Event / IsFullOption.php
1 <?php
2 /**
3 * Test Generated example of using event getsingle API
4 * demonstrates use of return is_full *
5 */
6 function event_getsingle_example(){
7 $params = array(
8 'id' => 1,
9 'return.is_full' => 1,
10 );
11
12 try{
13 $result = civicrm_api3('event', 'getsingle', $params);
14 }
15 catch (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 }
22
23 return $result;
24 }
25
26 /**
27 * Function returns array of result expected from previous function
28 */
29 function event_getsingle_expectedresult(){
30
31 $expectedResult = array(
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,
53 'created_date' => '2013-08-03 21:23:22',
54 'is_share' => '1',
55 'available_places' => 0,
56 'is_full' => '1',
57 );
58
59 return $expectedResult;
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
67 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EventTest.php
68 *
69 * You can see the outcome of the API tests at
70 * http://tests.dev.civicrm.org/trunk/results-api_v3
71 *
72 * To Learn about the API read
73 * http://book.civicrm.org/developer/current/techniques/api/
74 *
75 * and review the wiki at
76 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
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
83 */