test tweaks and updated examples
[civicrm-core.git] / api / v3 / examples / Participant / NestedEventGet.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using participant get API
4 * use nested get to get an event *
6a488035
TO
5 */
6function participant_get_example(){
53ca8fd7 7$params = array(
6a488035 8 'id' => 1,
6a488035
TO
9 'api.event.get' => 1,
10);
11
fb32de45 12try{
13 $result = civicrm_api3('participant', 'get', $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 participant_get_expectedresult(){
30
53ca8fd7 31 $expectedResult = array(
6a488035
TO
32 'is_error' => 0,
33 'version' => 3,
34 'count' => 1,
35 'id' => 1,
53ca8fd7 36 'values' => array(
37 '1' => array(
6a488035
TO
38 'contact_id' => '2',
39 'contact_type' => 'Individual',
40 'contact_sub_type' => '',
41 'sort_name' => 'Anderson, Anthony',
42 'display_name' => 'Mr. Anthony Anderson II',
43 'event_id' => '6',
44 'event_title' => 'Annual CiviCRM meet',
9f1b81e0 45 'event_start_date' => '2013-07-29 00:00:00',
46 'event_end_date' => '2013-08-04 00:00:00',
6a488035
TO
47 'participant_id' => '1',
48 'participant_fee_level' => '',
49 'participant_fee_amount' => '',
50 'participant_fee_currency' => '',
51 'event_type' => 'Conference',
52 'participant_status_id' => '2',
53 'participant_status' => 'Attended',
54 'participant_role_id' => '1',
55 'participant_register_date' => '2007-02-19 00:00:00',
56 'participant_source' => 'Wimbeldon',
57 'participant_note' => '',
58 'participant_is_pay_later' => 0,
59 'participant_is_test' => 0,
60 'participant_registered_by_id' => '',
61 'participant_discount_name' => '',
62 'participant_campaign_id' => '',
63 'id' => '1',
53ca8fd7 64 'api.event.get' => array(
6a488035
TO
65 'is_error' => 0,
66 'version' => 3,
67 'count' => 1,
68 'id' => 6,
53ca8fd7 69 'values' => array(
70 '0' => array(
6a488035
TO
71 'id' => '6',
72 'title' => 'Annual CiviCRM meet',
73 'event_title' => 'Annual CiviCRM meet',
74 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now',
75 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
76 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
77 'event_type_id' => '1',
78 'participant_listing_id' => 0,
79 'is_public' => '1',
9f1b81e0 80 'start_date' => '2013-07-29 00:00:00',
81 'event_start_date' => '2013-07-29 00:00:00',
82 'end_date' => '2013-08-04 00:00:00',
83 'event_end_date' => '2013-08-04 00:00:00',
6a488035
TO
84 'is_online_registration' => '1',
85 'registration_start_date' => '2008-06-01 00:00:00',
86 'registration_end_date' => '2008-10-15 00:00:00',
87 'max_participants' => '100',
88 'event_full_text' => 'Sorry! We are already full',
89 'is_monetary' => 0,
90 'is_map' => 0,
91 'is_active' => '1',
92 'is_show_location' => 0,
93 'default_role_id' => '1',
94 'is_email_confirm' => 0,
95 'is_pay_later' => 0,
96 'is_partial_payment' => 0,
97 'is_multiple_registrations' => 0,
98 'allow_same_participant_emails' => 0,
99 'is_template' => 0,
f27f2724 100 'created_date' => '2013-07-28 08:49:19',
6a488035
TO
101 'is_share' => '1',
102 ),
103 ),
104 ),
105 ),
106 ),
107);
108
fb32de45 109 return $expectedResult;
6a488035
TO
110}
111
112
113/*
114* This example has been generated from the API test suite. The test that created it is called
115*
116* testGetNestedEventGet and can be found in
117* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ParticipantTest.php
118*
119* You can see the outcome of the API tests at
120* http://tests.dev.civicrm.org/trunk/results-api_v3
121*
122* To Learn about the API read
123* http://book.civicrm.org/developer/current/techniques/api/
124*
125* and review the wiki at
126* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
127*
128* Read more about testing here
129* http://wiki.civicrm.org/confluence/display/CRM/Testing
130*
131* API Standards documentation:
132* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
133*/