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