Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-07-14-22-39-05
[civicrm-core.git] / api / v3 / examples / ProfileApply.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4
5 */
6function profile_apply_example(){
53ca8fd7 7$params = array(
6a488035
TO
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','apply',$params );
20
21 return $result;
22}
23
24/*
25 * Function returns array of result expected from previous function
26 */
27function profile_apply_expectedresult(){
28
53ca8fd7 29 $expectedResult = array(
6a488035
TO
30 'is_error' => 0,
31 'version' => 3,
32 'count' => 10,
53ca8fd7 33 'values' => array(
6a488035
TO
34 'contact_type' => 'Individual',
35 'contact_sub_type' => '',
36 'contact_id' => 1,
37 'profile_id' => 25,
38 'version' => 3,
39 'first_name' => 'abc2',
40 'last_name' => 'xyz2',
53ca8fd7 41 'email' => array(
42 '1' => array(
6a488035
TO
43 'location_type_id' => '1',
44 'is_primary' => 1,
45 'email' => 'abc2.xyz2@gmail.com',
46 ),
47 ),
53ca8fd7 48 'phone' => array(
49 '2' => array(
6a488035
TO
50 'location_type_id' => '1',
51 'is_primary' => 1,
52 'phone_type_id' => '1',
53 'phone' => '022 321 826',
54 ),
55 ),
53ca8fd7 56 'address' => array(
57 '1' => array(
6a488035
TO
58 'location_type_id' => '1',
59 'is_primary' => 1,
60 'country_id' => '1013',
61 'state_province_id' => '1000',
62 ),
63 ),
64 ),
65);
66
67 return $expectedResult ;
68}
69
70
71/*
72* This example has been generated from the API test suite. The test that created it is called
73*
74* testProfileApply and can be found in
75* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ProfileTest.php
76*
77* You can see the outcome of the API tests at
78* http://tests.dev.civicrm.org/trunk/results-api_v3
79*
80* To Learn about the API read
81* http://book.civicrm.org/developer/current/techniques/api/
82*
83* and review the wiki at
84* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
85*
86* Read more about testing here
87* http://wiki.civicrm.org/confluence/display/CRM/Testing
88*
89* API Standards documentation:
90* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
91*/