Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using event getsingle API | |
4 | * demonstrates use of return is_full * | |
6a488035 TO |
5 | */ |
6 | function event_getsingle_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 | 8 | 'id' => 1, |
6a488035 TO |
9 | 'return.is_full' => 1, |
10 | ); | |
11 | ||
fb32de45 | 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 | } | |
6a488035 | 22 | |
fb32de45 | 23 | return $result; |
6a488035 TO |
24 | } |
25 | ||
fb32de45 | 26 | /** |
6a488035 TO |
27 | * Function returns array of result expected from previous function |
28 | */ | |
29 | function 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, | |
89bf81b4 | 53 | 'created_date' => '2014-09-28 23:20:52', |
6a488035 | 54 | 'is_share' => '1', |
89bf81b4 | 55 | 'is_confirm_enabled' => '1', |
6a488035 TO |
56 | 'available_places' => 0, |
57 | 'is_full' => '1', | |
58 | ); | |
59 | ||
fb32de45 | 60 | return $expectedResult; |
6a488035 TO |
61 | } |
62 | ||
63 | ||
64 | /* | |
65 | * This example has been generated from the API test suite. The test that created it is called | |
66 | * | |
67 | * testGetSingleReturnIsFull and can be found in | |
69d79249 | 68 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php |
6a488035 TO |
69 | * |
70 | * You can see the outcome of the API tests at | |
69d79249 | 71 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
6a488035 TO |
72 | * |
73 | * To Learn about the API read | |
69d79249 | 74 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
6a488035 | 75 | * |
69d79249 E |
76 | * Browse the api on your own site with the api explorer |
77 | * http://MYSITE.ORG/path/to/civicrm/api/explorer | |
6a488035 TO |
78 | * |
79 | * Read more about testing here | |
80 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
81 | * | |
82 | * API Standards documentation: | |
83 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 84 | */ |