Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | This demonstrates use of the 'format.single_entity_array' param. | |
5 | /* This param causes the only contact to be returned as an array without the other levels. | |
6 | /* it will be ignored if there is not exactly 1 result | |
7 | */ | |
8 | function contact_getsingle_example(){ | |
9 | $params = array( | |
10 | 'version' => 3, | |
11 | 'id' => 17, | |
12 | ); | |
13 | ||
14 | $result = civicrm_api( 'contact','getsingle',$params ); | |
15 | ||
16 | return $result; | |
17 | } | |
18 | ||
19 | /* | |
20 | * Function returns array of result expected from previous function | |
21 | */ | |
22 | function contact_getsingle_expectedresult(){ | |
23 | ||
24 | $expectedResult = array( | |
25 | 'contact_id' => '17', | |
26 | 'contact_type' => 'Individual', | |
27 | 'contact_sub_type' => '', | |
28 | 'sort_name' => '', | |
29 | 'display_name' => 'Test Contact', | |
30 | 'do_not_email' => '', | |
31 | 'do_not_phone' => '', | |
32 | 'do_not_mail' => '', | |
33 | 'do_not_sms' => '', | |
34 | 'do_not_trade' => '', | |
35 | 'is_opt_out' => 0, | |
36 | 'legal_identifier' => '', | |
37 | 'external_identifier' => '', | |
38 | 'nick_name' => '', | |
39 | 'legal_name' => '', | |
40 | 'image_URL' => '', | |
41 | 'preferred_mail_format' => '', | |
42 | 'first_name' => 'Test', | |
43 | 'middle_name' => '', | |
44 | 'last_name' => 'Contact', | |
45 | 'job_title' => '', | |
46 | 'birth_date' => '', | |
47 | 'is_deceased' => 0, | |
48 | 'deceased_date' => '', | |
49 | 'household_name' => '', | |
50 | 'organization_name' => '', | |
51 | 'sic_code' => '', | |
52 | 'contact_is_deleted' => 0, | |
53 | 'gender_id' => '', | |
54 | 'gender' => '', | |
55 | 'prefix_id' => '', | |
56 | 'prefix' => '', | |
57 | 'suffix_id' => '', | |
58 | 'suffix' => '', | |
59 | 'current_employer' => '', | |
60 | 'address_id' => '', | |
61 | 'street_address' => '', | |
62 | 'supplemental_address_1' => '', | |
63 | 'supplemental_address_2' => '', | |
64 | 'city' => '', | |
65 | 'postal_code_suffix' => '', | |
66 | 'postal_code' => '', | |
67 | 'geo_code_1' => '', | |
68 | 'geo_code_2' => '', | |
69 | 'state_province_id' => '', | |
70 | 'state_province_name' => '', | |
71 | 'state_province' => '', | |
72 | 'country_id' => '', | |
73 | 'country' => '', | |
74 | 'phone_id' => '', | |
75 | 'phone_type_id' => '', | |
76 | 'phone' => '', | |
77 | 'email_id' => '', | |
78 | 'email' => '', | |
79 | 'on_hold' => '', | |
80 | 'im_id' => '', | |
81 | 'provider_id' => '', | |
82 | 'im' => '', | |
83 | 'worldregion_id' => '', | |
84 | 'world_region' => '', | |
85 | 'id' => '17', | |
86 | ); | |
87 | ||
88 | return $expectedResult ; | |
89 | } | |
90 | ||
91 | ||
92 | /* | |
93 | * This example has been generated from the API test suite. The test that created it is called | |
94 | * | |
95 | * testContactGetSingle_entity_array and can be found in | |
96 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php | |
97 | * | |
98 | * You can see the outcome of the API tests at | |
99 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
100 | * | |
101 | * To Learn about the API read | |
102 | * http://book.civicrm.org/developer/current/techniques/api/ | |
103 | * | |
104 | * and review the wiki at | |
105 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
106 | * | |
107 | * Read more about testing here | |
108 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
109 | * | |
110 | * API Standards documentation: | |
111 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
112 | */ |