Merge pull request #1226 from kurund/CRM-11137
[civicrm-core.git] / api / v3 / examples / ProfileSet.php
1 <?php
2
3 /*
4
5 */
6 function profile_set_example(){
7 $params = array(
8 'profile_id' => 25,
9 'contact_id' => 1,
10 'version' => 3,
11 'first_name' => 'abc2',
12 'last_name' => 'xyz2',
13 'email-Primary' => 'abc2.xyz2@gmail.com',
14 'phone-1-1' => '022 321 826',
15 'country-1' => '1013',
16 'state_province-1' => '1000',
17 );
18
19 $result = civicrm_api( 'profile','set',$params );
20
21 return $result;
22 }
23
24 /*
25 * Function returns array of result expected from previous function
26 */
27 function profile_set_expectedresult(){
28
29 $expectedResult = array(
30 'is_error' => 0,
31 'version' => 3,
32 'count' => 1,
33 'id' => 1,
34 'values' => array(
35 '1' => array(
36 'id' => '1',
37 'contact_type' => 'Individual',
38 'contact_sub_type' => '',
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 'sort_name' => 'xyz2, abc2',
48 'display_name' => 'abc2 xyz2',
49 'nick_name' => '',
50 'legal_name' => '',
51 'image_URL' => '',
52 'preferred_communication_method' => '',
53 'preferred_language' => 'en_US',
54 'preferred_mail_format' => 'Both',
55 'hash' => '67eac7789eaee00',
56 'api_key' => '',
57 'first_name' => 'abc2',
58 'middle_name' => '',
59 'last_name' => 'xyz2',
60 'prefix_id' => '',
61 'suffix_id' => '',
62 'email_greeting_id' => '1',
63 'email_greeting_custom' => '',
64 'email_greeting_display' => 'Dear',
65 'postal_greeting_id' => '1',
66 'postal_greeting_custom' => '',
67 'postal_greeting_display' => 'Dear',
68 'addressee_id' => '1',
69 'addressee_custom' => '',
70 'addressee_display' => '',
71 'job_title' => '',
72 'gender_id' => '',
73 'birth_date' => '',
74 'is_deceased' => 0,
75 'deceased_date' => '',
76 'household_name' => '',
77 'primary_contact_id' => '',
78 'organization_name' => '',
79 'sic_code' => '',
80 'user_unique_id' => '',
81 'created_date' => '20120130621222105',
82 'modified_date' => '2012-11-14 16:02:35',
83 ),
84 ),
85 );
86
87 return $expectedResult ;
88 }
89
90
91 /*
92 * This example has been generated from the API test suite. The test that created it is called
93 *
94 * testProfileSet and can be found in
95 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ProfileTest.php
96 *
97 * You can see the outcome of the API tests at
98 * http://tests.dev.civicrm.org/trunk/results-api_v3
99 *
100 * To Learn about the API read
101 * http://book.civicrm.org/developer/current/techniques/api/
102 *
103 * and review the wiki at
104 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
105 *
106 * Read more about testing here
107 * http://wiki.civicrm.org/confluence/display/CRM/Testing
108 *
109 * API Standards documentation:
110 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
111 */