update test generated examples
[civicrm-core.git] / api / v3 / examples / Contact / APIChainedArrayMultipleCustom.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 /*this demonstrates the usage of chained api functions. A variety of techniques are used
5 */
6function contact_get_example(){
edb0d67a 7$params = array(
6a488035
TO
8 'id' => 1,
9 'version' => 3,
edb0d67a 10 'api.website.getValue' => array(
6a488035
TO
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 */
25function contact_get_expectedresult(){
26
edb0d67a 27 $expectedResult = array(
6a488035
TO
28 'is_error' => 0,
29 'version' => 3,
30 'count' => 1,
31 'id' => 1,
edb0d67a 32 'values' => array(
33 '1' => array(
6a488035
TO
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,
6a488035
TO
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,
edb0d67a 91 'api.CustomValue.get' => array(
6a488035
TO
92 'is_error' => 0,
93 'version' => 3,
94 'count' => 10,
edb0d67a 95 'values' => array(
96 '0' => array(
6a488035
TO
97 'entity_id' => '1',
98 'latest' => 'value 4',
edb0d67a 99 'id' => '13',
6a488035
TO
100 '0' => 'value 4',
101 ),
edb0d67a 102 '1' => array(
6a488035
TO
103 'entity_table' => 'Contact',
104 ),
edb0d67a 105 '2' => array(
6a488035
TO
106 'entity_id' => '1',
107 'latest' => 'value 3',
edb0d67a 108 'id' => '14',
6a488035
TO
109 '1' => 'value 2',
110 '2' => 'value 3',
111 ),
edb0d67a 112 '3' => array(
6a488035
TO
113 'entity_table' => 'Contact',
114 ),
edb0d67a 115 '4' => array(
6a488035
TO
116 'entity_id' => '1',
117 'latest' => '',
edb0d67a 118 'id' => '15',
6a488035
TO
119 '1' => 'warm beer',
120 '2' => '',
121 ),
edb0d67a 122 '5' => array(
6a488035
TO
123 'entity_id' => '1',
124 'latest' => '',
edb0d67a 125 'id' => '16',
6a488035
TO
126 '1' => '',
127 '2' => '',
128 ),
edb0d67a 129 '6' => array(
6a488035
TO
130 'entity_table' => 'Contact',
131 ),
edb0d67a 132 '7' => array(
6a488035
TO
133 'entity_id' => '1',
134 'latest' => '',
edb0d67a 135 'id' => '17',
6a488035
TO
136 '1' => '',
137 ),
edb0d67a 138 '8' => array(
6a488035
TO
139 'entity_id' => '1',
140 'latest' => 'vegemite',
edb0d67a 141 'id' => '18',
6a488035
TO
142 '1' => 'vegemite',
143 ),
edb0d67a 144 '9' => array(
6a488035
TO
145 'entity_id' => '1',
146 'latest' => '',
edb0d67a 147 'id' => '19',
6a488035
TO
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*/