Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using event get API | |
4 | * demonstrates use of is.Current option * | |
6a488035 TO |
5 | */ |
6 | function event_get_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 TO |
8 | 'isCurrent' => 1, |
9 | ); | |
10 | ||
fb32de45 | 11 | try{ |
12 | $result = civicrm_api3('event', 'get', $params); | |
13 | } | |
14 | catch (CiviCRM_API3_Exception $e) { | |
15 | // handle error here | |
16 | $errorMessage = $e->getMessage(); | |
17 | $errorCode = $e->getErrorCode(); | |
18 | $errorData = $e->getExtraParams(); | |
19 | return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); | |
20 | } | |
6a488035 | 21 | |
fb32de45 | 22 | return $result; |
6a488035 TO |
23 | } |
24 | ||
fb32de45 | 25 | /** |
6a488035 TO |
26 | * Function returns array of result expected from previous function |
27 | */ | |
28 | function event_get_expectedresult(){ | |
29 | ||
53ca8fd7 | 30 | $expectedResult = array( |
6a488035 TO |
31 | 'is_error' => 0, |
32 | 'version' => 3, | |
33 | 'count' => 1, | |
34 | 'id' => 3, | |
53ca8fd7 | 35 | 'values' => array( |
36 | '3' => array( | |
6a488035 TO |
37 | 'id' => '3', |
38 | 'title' => 'Annual CiviCRM meet 2', | |
39 | 'event_title' => 'Annual CiviCRM meet 2', | |
40 | 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', | |
41 | 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', | |
42 | 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', | |
43 | 'event_type_id' => '1', | |
44 | 'participant_listing_id' => 0, | |
45 | 'is_public' => '1', | |
fb32de45 | 46 | 'start_date' => '2013-07-29 00:00:00', |
47 | 'event_start_date' => '2013-07-29 00:00:00', | |
48 | 'end_date' => '2013-08-04 00:00:00', | |
49 | 'event_end_date' => '2013-08-04 00:00:00', | |
6a488035 TO |
50 | 'is_online_registration' => '1', |
51 | 'registration_start_date' => '2010-06-01 00:00:00', | |
52 | 'registration_end_date' => '2010-10-15 00:00:00', | |
53 | 'max_participants' => '100', | |
54 | 'event_full_text' => 'Sorry! We are already full', | |
55 | 'is_monetary' => 0, | |
56 | 'is_map' => 0, | |
57 | 'is_active' => '1', | |
58 | 'is_show_location' => 0, | |
59 | 'default_role_id' => '1', | |
60 | 'is_email_confirm' => 0, | |
61 | 'is_pay_later' => 0, | |
62 | 'is_partial_payment' => 0, | |
63 | 'is_multiple_registrations' => 0, | |
64 | 'allow_same_participant_emails' => 0, | |
65 | 'is_template' => 0, | |
f27f2724 | 66 | 'created_date' => '2013-07-28 08:49:19', |
6a488035 TO |
67 | 'is_share' => '1', |
68 | ), | |
69 | ), | |
70 | ); | |
71 | ||
fb32de45 | 72 | return $expectedResult; |
6a488035 TO |
73 | } |
74 | ||
75 | ||
76 | /* | |
77 | * This example has been generated from the API test suite. The test that created it is called | |
78 | * | |
79 | * testGetIsCurrent and can be found in | |
69d79249 | 80 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php |
6a488035 TO |
81 | * |
82 | * You can see the outcome of the API tests at | |
69d79249 | 83 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
6a488035 TO |
84 | * |
85 | * To Learn about the API read | |
69d79249 | 86 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
6a488035 | 87 | * |
69d79249 E |
88 | * Browse the api on your own site with the api explorer |
89 | * http://MYSITE.ORG/path/to/civicrm/api/explorer | |
6a488035 TO |
90 | * |
91 | * Read more about testing here | |
92 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
93 | * | |
94 | * API Standards documentation: | |
95 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 96 | */ |