Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function uf_field_replace_example(){ | |
7 | $params = array( | |
8 | 'version' => 3, | |
9 | 'uf_group_id' => 11, | |
10 | 'option.autoweight' => '', | |
11 | 'values' => array( | |
12 | '0' => array( | |
13 | 'field_name' => 'first_name', | |
14 | 'field_type' => 'Contact', | |
15 | 'visibility' => 'Public Pages and Listings', | |
16 | 'weight' => 3, | |
17 | 'label' => 'Test First Name', | |
18 | 'is_searchable' => 1, | |
19 | 'is_active' => 1, | |
20 | ), | |
21 | '1' => array( | |
22 | 'field_name' => 'country', | |
23 | 'field_type' => 'Contact', | |
24 | 'visibility' => 'Public Pages and Listings', | |
25 | 'weight' => 2, | |
26 | 'label' => 'Test Country', | |
27 | 'is_searchable' => 1, | |
28 | 'is_active' => 1, | |
29 | 'location_type_id' => 1, | |
30 | ), | |
31 | '2' => array( | |
32 | 'field_name' => 'phone', | |
33 | 'field_type' => 'Contact', | |
34 | 'visibility' => 'Public Pages and Listings', | |
35 | 'weight' => 1, | |
36 | 'label' => 'Test Phone', | |
37 | 'is_searchable' => 1, | |
38 | 'is_active' => 1, | |
39 | 'location_type_id' => 1, | |
40 | 'phone_type_id' => 1, | |
41 | ), | |
42 | ), | |
43 | ); | |
44 | ||
45 | $result = civicrm_api( 'uf_field','replace',$params ); | |
46 | ||
47 | return $result; | |
48 | } | |
49 | ||
50 | /* | |
51 | * Function returns array of result expected from previous function | |
52 | */ | |
53 | function uf_field_replace_expectedresult(){ | |
54 | ||
55 | $expectedResult = array( | |
56 | 'is_error' => 0, | |
57 | 'version' => 3, | |
58 | 'count' => 3, | |
59 | 'values' => array( | |
60 | '1' => array( | |
61 | 'id' => '1', | |
62 | 'uf_group_id' => '11', | |
63 | 'field_name' => 'first_name', | |
64 | 'is_active' => '1', | |
65 | 'is_view' => '', | |
66 | 'is_required' => '', | |
67 | 'weight' => '3', | |
68 | 'help_post' => '', | |
69 | 'help_pre' => '', | |
70 | 'visibility' => 'Public Pages and Listings', | |
71 | 'in_selector' => '', | |
72 | 'is_searchable' => '1', | |
73 | 'location_type_id' => 'null', | |
74 | 'phone_type_id' => '', | |
75 | 'label' => 'Test First Name', | |
76 | 'field_type' => 'Contact', | |
77 | 'is_reserved' => '', | |
78 | 'is_multi_summary' => '', | |
79 | ), | |
80 | '2' => array( | |
81 | 'id' => '2', | |
82 | 'uf_group_id' => '11', | |
83 | 'field_name' => 'country', | |
84 | 'is_active' => '1', | |
85 | 'is_view' => '', | |
86 | 'is_required' => '', | |
87 | 'weight' => '2', | |
88 | 'help_post' => '', | |
89 | 'help_pre' => '', | |
90 | 'visibility' => 'Public Pages and Listings', | |
91 | 'in_selector' => '', | |
92 | 'is_searchable' => '1', | |
93 | 'location_type_id' => '1', | |
94 | 'phone_type_id' => '', | |
95 | 'label' => 'Test Country', | |
96 | 'field_type' => 'Contact', | |
97 | 'is_reserved' => '', | |
98 | 'is_multi_summary' => '', | |
99 | ), | |
100 | '3' => array( | |
101 | 'id' => '3', | |
102 | 'uf_group_id' => '11', | |
103 | 'field_name' => 'phone', | |
104 | 'is_active' => '1', | |
105 | 'is_view' => '', | |
106 | 'is_required' => '', | |
107 | 'weight' => '1', | |
108 | 'help_post' => '', | |
109 | 'help_pre' => '', | |
110 | 'visibility' => 'Public Pages and Listings', | |
111 | 'in_selector' => '', | |
112 | 'is_searchable' => '1', | |
113 | 'location_type_id' => '1', | |
114 | 'phone_type_id' => '1', | |
115 | 'label' => 'Test Phone', | |
116 | 'field_type' => 'Contact', | |
117 | 'is_reserved' => '', | |
118 | 'is_multi_summary' => '', | |
119 | ), | |
120 | ), | |
121 | ); | |
122 | ||
123 | return $expectedResult ; | |
124 | } | |
125 | ||
126 | ||
127 | /* | |
128 | * This example has been generated from the API test suite. The test that created it is called | |
129 | * | |
130 | * testReplaceUFFields and can be found in | |
131 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/UFFieldTest.php | |
132 | * | |
133 | * You can see the outcome of the API tests at | |
134 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
135 | * | |
136 | * To Learn about the API read | |
137 | * http://book.civicrm.org/developer/current/techniques/api/ | |
138 | * | |
139 | * and review the wiki at | |
140 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
141 | * | |
142 | * Read more about testing here | |
143 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
144 | * | |
145 | * API Standards documentation: | |
146 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
147 | */ |