update test generated examples
[civicrm-core.git] / api / v3 / examples / Contact / APIChainedArrayMultipleCustom.php
1 <?php
2
3 /*
4 /*this demonstrates the usage of chained api functions. A variety of techniques are used
5 */
6 function contact_get_example(){
7 $params = array(
8 'id' => 1,
9 'version' => 3,
10 'api.website.getValue' => array(
11 'return' => 'url',
12 ),
13 'api.Contribution.getCount' => array(),
14 'api.CustomValue.get' => 1,
15 );
16
17 $result = civicrm_api( 'contact','get',$params );
18
19 return $result;
20 }
21
22 /*
23 * Function returns array of result expected from previous function
24 */
25 function contact_get_expectedresult(){
26
27 $expectedResult = array(
28 'is_error' => 0,
29 'version' => 3,
30 'count' => 1,
31 'id' => 1,
32 'values' => array(
33 '1' => array(
34 'contact_id' => '1',
35 'contact_type' => 'Individual',
36 'contact_sub_type' => '',
37 'sort_name' => 'xyz3, abc3',
38 'display_name' => 'abc3 xyz3',
39 'do_not_email' => 0,
40 'do_not_phone' => 0,
41 'do_not_mail' => 0,
42 'do_not_sms' => 0,
43 'do_not_trade' => 0,
44 'is_opt_out' => 0,
45 'legal_identifier' => '',
46 'external_identifier' => '',
47 'nick_name' => '',
48 'legal_name' => '',
49 'image_URL' => '',
50 'preferred_mail_format' => 'Both',
51 'first_name' => 'abc3',
52 'middle_name' => '',
53 'last_name' => 'xyz3',
54 'job_title' => '',
55 'birth_date' => '',
56 'is_deceased' => 0,
57 'deceased_date' => '',
58 'household_name' => '',
59 'organization_name' => '',
60 'sic_code' => '',
61 'contact_is_deleted' => 0,
62 'current_employer' => '',
63 'address_id' => '',
64 'street_address' => '',
65 'supplemental_address_1' => '',
66 'supplemental_address_2' => '',
67 'city' => '',
68 'postal_code_suffix' => '',
69 'postal_code' => '',
70 'geo_code_1' => '',
71 'geo_code_2' => '',
72 'state_province_id' => '',
73 'state_province_name' => '',
74 'state_province' => '',
75 'country_id' => '',
76 'country' => '',
77 'phone_id' => '',
78 'phone_type_id' => '',
79 'phone' => '',
80 'email_id' => '1',
81 'email' => 'man3@yahoo.com',
82 'on_hold' => 0,
83 'im_id' => '',
84 'provider_id' => '',
85 'im' => '',
86 'worldregion_id' => '',
87 'world_region' => '',
88 'id' => '1',
89 'api.website.getValue' => 'http://civicrm.org',
90 'api.Contribution.getCount' => 2,
91 'api.CustomValue.get' => array(
92 'is_error' => 0,
93 'version' => 3,
94 'count' => 10,
95 'values' => array(
96 '0' => array(
97 'entity_id' => '1',
98 'latest' => 'value 4',
99 'id' => '13',
100 '0' => 'value 4',
101 ),
102 '1' => array(
103 'entity_table' => 'Contact',
104 ),
105 '2' => array(
106 'entity_id' => '1',
107 'latest' => 'value 3',
108 'id' => '14',
109 '1' => 'value 2',
110 '2' => 'value 3',
111 ),
112 '3' => array(
113 'entity_table' => 'Contact',
114 ),
115 '4' => array(
116 'entity_id' => '1',
117 'latest' => '',
118 'id' => '15',
119 '1' => 'warm beer',
120 '2' => '',
121 ),
122 '5' => array(
123 'entity_id' => '1',
124 'latest' => '',
125 'id' => '16',
126 '1' => '',
127 '2' => '',
128 ),
129 '6' => array(
130 'entity_table' => 'Contact',
131 ),
132 '7' => array(
133 'entity_id' => '1',
134 'latest' => '',
135 'id' => '17',
136 '1' => '',
137 ),
138 '8' => array(
139 'entity_id' => '1',
140 'latest' => 'vegemite',
141 'id' => '18',
142 '1' => 'vegemite',
143 ),
144 '9' => array(
145 'entity_id' => '1',
146 'latest' => '',
147 'id' => '19',
148 '1' => '',
149 ),
150 ),
151 ),
152 ),
153 ),
154 );
155
156 return $expectedResult ;
157 }
158
159
160 /*
161 * This example has been generated from the API test suite. The test that created it is called
162 *
163 * testGetIndividualWithChainedArraysAndMultipleCustom and can be found in
164 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
165 *
166 * You can see the outcome of the API tests at
167 * http://tests.dev.civicrm.org/trunk/results-api_v3
168 *
169 * To Learn about the API read
170 * http://book.civicrm.org/developer/current/techniques/api/
171 *
172 * and review the wiki at
173 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
174 *
175 * Read more about testing here
176 * http://wiki.civicrm.org/confluence/display/CRM/Testing
177 *
178 * API Standards documentation:
179 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
180 */