4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.4 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
30 * Include class definitions
32 require_once 'tests/phpunit/CiviTest/CiviUnitTestCase.php';
35 * Test APIv3 civicrm_profile_* functions
39 class api_v3_ProfileTest
extends CiviUnitTestCase
{
40 protected $_apiversion;
41 protected $_profileID = 0;
44 'name' => 'Profile Test',
45 'description' => 'Test all profile API methods.',
46 'group' => 'CiviCRM API Tests',
51 $this->_apiversion
= 3;
53 $config = CRM_Core_Config
::singleton();
54 $config->countryLimit
[1] = 1013;
55 $config->stateLimit
[1] = 1013;
56 $this->createLoggedInUser();
61 $this->quickCleanup(array(
66 // ok can't be bothered wring an api to do this & truncating is crazy
67 CRM_Core_DAO
::executeQuery(" DELETE FROM civicrm_uf_group WHERE id IN ($this->_profileID, 26)");
70 ////////////// test $this->callAPISuccess3_profile_get //////////////////
73 * check Without ProfileId
75 function testProfileGetWithoutProfileId() {
79 $result = $this->callAPIFailure('profile', 'get', $params,
80 'Mandatory key(s) missing from params array: profile_id'
85 * check with no invalid profile Id
87 function testProfileGetInvalidProfileId() {
92 $result = $this->callAPIFailure('profile', 'get', $params);
98 function testProfileGet() {
99 $pofileFieldValues = $this->_createIndividualContact();
100 $expected = current($pofileFieldValues);
101 $contactId = key($pofileFieldValues);
103 'profile_id' => $this->_profileID
,
104 'contact_id' => $contactId,
106 $result = $this->callAPISuccess('profile', 'get', $params);
107 foreach ($expected as $profileField => $value) {
108 $this->assertEquals($value, CRM_Utils_Array
::value($profileField, $result['values']));
112 function testProfileGetMultiple() {
113 $pofileFieldValues = $this->_createIndividualContact();
114 $expected = current($pofileFieldValues);
115 $contactId = key($pofileFieldValues);
117 'profile_id' => array($this->_profileID
, 1, 'Billing'),
118 'contact_id' => $contactId,
121 $result = $this->callAPIAndDocument('profile', 'get', $params, __FUNCTION__
, __FILE__
);
122 foreach ($expected as $profileField => $value) {
123 $this->assertEquals($value, CRM_Utils_Array
::value($profileField, $result['values'][$this->_profileID
]), " error message: " . "missing/mismatching value for {$profileField}");
125 $this->assertEquals('abc1', $result['values'][1]['first_name'], " error message: " . "missing/mismatching value for {$profileField}");
126 $this->assertFalse(array_key_exists('email-Primary', $result['values'][1]), 'profile 1 doesn not include email');
127 $this->assertEquals($result['values']['Billing'], array(
128 'billing_first_name' => 'abc1',
129 'billing_middle_name' => 'J.',
130 'billing_last_name' => 'xyz1',
131 'billing_street_address-5' => '5 Saint Helier St',
132 'billing_city-5' => 'Gotham City',
133 'billing_state_province_id-5' => '1021',
134 'billing_country_id-5' => '1228',
135 'billing-email-5' => 'abc1.xyz1@yahoo.com',
136 'billing_postal_code-5' => '90210',
137 'billing-email-5' => 'abc1.xyz1@yahoo.com',
138 'email-5' => 'abc1.xyz1@yahoo.com',
142 function testProfileGetBillingUseIsBillingLocation() {
143 $individual = $this->_createIndividualContact();
144 $contactId = key($individual);
145 $this->callAPISuccess('address', 'create', array(
147 'street_address' => 'is billing st',
148 'location_type_id' => 2,
149 'contact_id' => $contactId,
152 $expected = current($individual);
155 'profile_id' => array($this->_profileID
, 1, 'Billing'),
156 'contact_id' => $contactId,
159 $result = $this->callAPISuccess('profile', 'get', $params);
160 $this->assertEquals('abc1', $result['values'][1]['first_name']);
161 $this->assertEquals(array(
162 'billing_first_name' => 'abc1',
163 'billing_middle_name' => 'J.',
164 'billing_last_name' => 'xyz1',
165 'billing_street_address-5' => 'is billing st',
166 'billing_city-5' => '',
167 'billing_state_province_id-5' => '',
168 'billing_country_id-5' => '',
169 'billing-email-5' => 'abc1.xyz1@yahoo.com',
170 'email-5' => 'abc1.xyz1@yahoo.com',
171 'billing_postal_code-5' => '',
172 ), $result['values']['Billing']);
175 function testProfileGetMultipleHasBillingLocation() {
176 $individual = $this->_createIndividualContact();
177 $contactId = key($individual);
178 $this->callAPISuccess('address', 'create', array('contact_id' => $contactId , 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5));
179 $this->callAPISuccess('email', 'create', array('contact_id' => $contactId , 'email' => 'big@once.com', 'location_type_id' => 2, 'is_billing' => 1));
181 $expected = current($individual);
184 'profile_id' => array($this->_profileID
, 1, 'Billing'),
185 'contact_id' => $contactId,
188 $result = $this->callAPISuccess('profile', 'get', $params, __FUNCTION__
, __FILE__
);
189 $this->assertEquals('abc1', $result['values'][1]['first_name']);
190 $this->assertEquals($result['values']['Billing'], array(
191 'billing_first_name' => 'abc1',
192 'billing_middle_name' => 'J.',
193 'billing_last_name' => 'xyz1',
194 'billing_street_address-5' => '25 Big Street',
195 'billing_city-5' => 'big city',
196 'billing_state_province_id-5' => '',
197 'billing_country_id-5' => '',
198 'billing-email-5' => 'big@once.com',
199 'email-5' => 'big@once.com',
200 'billing_postal_code-5' => '',
205 * get Billing empty contact - this will return generic defaults
207 function testProfileGetBillingEmptyContact() {
210 'profile_id' => array('Billing'),
213 $result = $this->callAPISuccess('profile', 'get', $params);
214 $this->assertEquals(array(
215 'billing_first_name' => '',
216 'billing_middle_name' => '',
217 'billing_last_name' => '',
218 'billing_street_address-5' => '',
219 'billing_city-5' => '',
220 'billing_state_province_id-5' => '',
221 'billing_country_id-5' => '1228',
222 'billing_email-5' => '',
224 'billing_postal_code-5' => '',
225 ), $result['values']['Billing']);
229 * check contact activity profile without activity id
231 function testContactActivityGetWithoutActivityId() {
232 list($params, $expected) = $this->_createContactWithActivity();
234 unset($params['activity_id']);
235 $result = $this->callAPIFailure('profile', 'get', $params,
236 'Mandatory key(s) missing from params array: activity_id');
240 * check contact activity profile wrong activity id
242 function testContactActivityGetWrongActivityId() {
243 list($params, $expected) = $this->_createContactWithActivity();
245 $params['activity_id'] = 100001;
246 $result = $this->callAPIFailure('profile', 'get', $params,
247 'Invalid Activity Id (aid).');
251 * check contact activity profile with wrong activity type
253 function testContactActivityGetWrongActivityType() {
254 //flush cache by calling with reset
255 $activityTypes = CRM_Core_PseudoConstant
::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
257 $sourceContactId = $this->householdCreate();
259 $activityparams = array(
260 'source_contact_id' => $sourceContactId,
261 'activity_type_id' => '2',
262 'subject' => 'Test activity',
263 'activity_date_time' => '20110316',
265 'location' => 'Pensulvania',
266 'details' => 'a test activity',
268 'priority_id' => '1',
271 $activity = $this->callAPISuccess('activity', 'create', $activityparams);
273 $activityValues = array_pop($activity['values']);
275 list($params, $expected) = $this->_createContactWithActivity();
277 $params['activity_id'] = $activityValues['id'];
278 $result = $this->callAPIFailure('profile', 'get', $params,
279 'This activity cannot be edited or viewed via this profile.'
284 * check contact activity profile with success
286 function testContactActivityGetSuccess() {
287 list($params, $expected) = $this->_createContactWithActivity();
289 $result = $this->callAPISuccess('profile', 'get', $params);
291 foreach ($expected as $profileField => $value) {
292 $this->assertEquals($value, CRM_Utils_Array
::value($profileField, $result['values']), "In line " . __LINE__
. " error message: " . "missing/mismatching value for {$profileField}"
298 * Check getfields works & gives us our fields
300 function testGetFields() {
301 $this->_createIndividualProfile();
302 $this->_addCustomFieldToProfile($this->_profileID
);
303 $result = $this->callAPIAndDocument('profile', 'getfields', array('action' => 'submit', 'profile_id' => $this->_profileID
), __FUNCTION__
, __FILE__
,
304 'demonstrates retrieving profile fields passing in an id');
305 $this->assertArrayKeyExists('first_name', $result['values']);
306 $this->assertEquals('2', $result['values']['first_name']['type']);
307 $this->assertEquals('Email', $result['values']['email-primary']['title']);
308 $this->assertEquals('civicrm_state_province', $result['values']['state_province-1']['pseudoconstant']['table']);
309 $this->assertEquals('defaultValue', $result['values']['custom_1']['default_value']);
310 $this->assertFalse(array_key_exists('participant_status', $result['values']));
313 * Check getfields works & gives us our fields - partipant profile
315 function testGetFieldsParticipantProfile() {
316 $result = $this->callAPISuccess('profile', 'getfields', array(
317 'action' => 'submit',
318 'profile_id' => 'participant_status',
319 'get_options' => 'all')
321 $this->assertTrue(array_key_exists('participant_status', $result['values']));
322 $this->assertEquals('Attended', $result['values']['participant_status']['options'][2]);
326 * Check getfields works & gives us our fields - membership_batch_entry
327 * (getting to the end with no e-notices is pretty good evidence it's working)
329 function testGetFieldsMembershipBatchProfile() {
330 $result = $this->callAPISuccess('profile', 'getfields', array(
331 'action' => 'submit',
332 'profile_id' => 'membership_batch_entry',
333 'get_options' => 'all')
335 $this->assertTrue(array_key_exists('total_amount', $result['values']));
336 $this->assertEquals(12, $result['values']['receive_date']['type']);
340 * Check getfields works & gives us our fields - do them all
341 * (getting to the end with no e-notices is pretty good evidence it's working)
343 function testGetFieldsAllProfiles() {
344 $result = $this->callAPISuccess('uf_group', 'get', array('return' => 'id'));
345 $profileIDs = array_keys($result['values']);
346 foreach ($profileIDs as $profileID) {
347 $result = $this->callAPISuccess('profile', 'getfields', array(
348 'action' => 'submit',
349 'profile_id' => $profileID,
350 'get_options' => 'all')
354 /////////////// test $this->callAPISuccess3_profile_set //////////////////
357 * check Without ProfileId
359 function testProfileSubmitWithoutProfileId() {
363 $result = $this->callAPIFailure('profile', 'submit', $params,
364 'Mandatory key(s) missing from params array: profile_id'
369 * check with no invalid profile Id
371 function testProfileSubmitInvalidProfileId() {
374 'profile_id' => 1000,
376 $result = $this->callAPIFailure('profile', 'submit', $params);
380 * check with missing required field in profile
382 function testProfileSubmitCheckProfileRequired() {
383 $pofileFieldValues = $this->_createIndividualContact();
384 current($pofileFieldValues);
385 $contactId = key($pofileFieldValues);
386 $updateParams = array(
387 'first_name' => 'abc2',
388 'last_name' => 'xyz2',
389 'phone-1-1' => '022 321 826',
390 'country-1' => '1013',
391 'state_province-1' => '1000',
394 $params = array_merge(array('profile_id' => $this->_profileID
, 'contact_id' => $contactId),
398 $result = $this->callAPIFailure('profile', 'submit', $params,
399 "Missing required parameters for profile id $this->_profileID: email-Primary"
406 function testProfileSubmit() {
407 $pofileFieldValues = $this->_createIndividualContact();
408 current($pofileFieldValues);
409 $contactId = key($pofileFieldValues);
411 $updateParams = array(
412 'first_name' => 'abc2',
413 'last_name' => 'xyz2',
414 'email-primary' => 'abc2.xyz2@gmail.com',
415 'phone-1-1' => '022 321 826',
416 'country-1' => '1013',
417 'state_province-1' => '1000',
420 $params = array_merge(array(
421 'profile_id' => $this->_profileID
,
422 'contact_id' => $contactId,
425 $result = $this->callAPIAndDocument('profile', 'submit', $params, __FUNCTION__
, __FILE__
);
428 'profile_id' => $this->_profileID
,
429 'contact_id' => $contactId,
431 $profileDetails = $this->callAPISuccess('profile', 'get', $getParams);
433 foreach ($updateParams as $profileField => $value) {
434 $this->assertEquals($value, CRM_Utils_Array
::value($profileField, $profileDetails['values']), "missing/mismatching value for {$profileField}"
437 unset($params['email-primary']);
438 $params['email-Primary'] = 'my@mail.com';
439 $this->callAPISuccess('profile', 'submit', $params);
440 $profileDetails = $this->callAPISuccess('profile', 'get', $getParams);
441 $this->assertEquals('my@mail.com', $profileDetails['values']['email-Primary']);
445 * set is deprecated but we need to ensure it still works
447 function testLegacySet() {
448 $pofileFieldValues = $this->_createIndividualContact();
449 current($pofileFieldValues);
450 $contactId = key($pofileFieldValues);
452 $updateParams = array(
453 'first_name' => 'abc2',
454 'last_name' => 'xyz2',
455 'email-Primary' => 'abc2.xyz2@gmail.com',
456 'phone-1-1' => '022 321 826',
457 'country-1' => '1013',
458 'state_province-1' => '1000',
461 $params = array_merge(array(
462 'profile_id' => $this->_profileID
,
463 'contact_id' => $contactId,
466 $result = $this->callAPISuccess('profile', 'set', $params);
467 $this->assertArrayKeyExists('values', $result);
469 'profile_id' => $this->_profileID
,
470 'contact_id' => $contactId,
472 $profileDetails = $this->callAPISuccess('profile', 'get', $getParams);
474 foreach ($updateParams as $profileField => $value) {
475 $this->assertEquals($value, CRM_Utils_Array
::value($profileField, $profileDetails['values']), "In line " . __LINE__
. " error message: " . "missing/mismatching value for {$profileField}"
480 * check contact activity profile without activity id
482 function testContactActivitySubmitWithoutActivityId() {
483 list($params, $expected) = $this->_createContactWithActivity();
485 $params = array_merge($params, $expected);
486 unset($params['activity_id']);
487 $result = $this->callAPIFailure('profile', 'submit', $params);
488 $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: activity_id');
492 * check contact activity profile wrong activity id
494 function testContactActivitySubmitWrongActivityId() {
495 list($params, $expected) = $this->_createContactWithActivity();
496 $params = array_merge($params, $expected);
497 $params['activity_id'] = 100001;
498 $result = $this->callAPIFailure('profile', 'submit', $params);
499 $this->assertEquals($result['error_message'], 'Invalid Activity Id (aid).');
503 * check contact activity profile with wrong activity type
505 function testContactActivitySubmitWrongActivityType() {
506 //flush cache by calling with reset
507 $activityTypes = CRM_Core_PseudoConstant
::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
509 $sourceContactId = $this->householdCreate();
511 $activityparams = array(
512 'source_contact_id' => $sourceContactId,
513 'activity_type_id' => '2',
514 'subject' => 'Test activity',
515 'activity_date_time' => '20110316',
517 'location' => 'Pensulvania',
518 'details' => 'a test activity',
520 'priority_id' => '1',
523 $activity = $this->callAPISuccess('activity', 'create', $activityparams);
525 $activityValues = array_pop($activity['values']);
527 list($params, $expected) = $this->_createContactWithActivity();
529 $params = array_merge($params, $expected);
530 $params['activity_id'] = $activityValues['id'];
531 $result = $this->callAPIFailure('profile', 'submit', $params,
532 'This activity cannot be edited or viewed via this profile.');
536 * check contact activity profile with success
538 function testContactActivitySubmitSuccess() {
539 list($params, $expected) = $this->_createContactWithActivity();
541 $updateParams = array(
542 'first_name' => 'abc2',
543 'last_name' => 'xyz2',
544 'email-Primary' => 'abc2.xyz2@yahoo.com',
545 'activity_subject' => 'Test Meeting',
546 'activity_details' => 'a test activity details',
547 'activity_duration' => '100',
548 'activity_date_time' => '03/08/2010',
549 'activity_status_id' => '2',
551 $profileParams = array_merge($params, $updateParams);
552 $this->callAPISuccess('profile', 'submit', $profileParams);
553 $result = $this->callAPISuccess('profile', 'get', $params);
555 foreach ($updateParams as $profileField => $value) {
556 $this->assertEquals($value, CRM_Utils_Array
::value($profileField, $result['values']), "In line " . __LINE__
. " error message: " . "missing/mismatching value for {$profileField}"
562 * check profile apply Without ProfileId
564 function testProfileApplyWithoutProfileId() {
568 $result = $this->callAPIFailure('profile', 'apply', $params,
569 'Mandatory key(s) missing from params array: profile_id');
573 * check profile apply with no invalid profile Id
575 function testProfileApplyInvalidProfileId() {
578 'profile_id' => 1000,
580 $result = $this->callAPIFailure('profile', 'apply', $params);
586 function testProfileApply() {
587 $pofileFieldValues = $this->_createIndividualContact();
588 current($pofileFieldValues);
589 $contactId = key($pofileFieldValues);
592 'profile_id' => $this->_profileID
,
593 'contact_id' => $contactId,
594 'first_name' => 'abc2',
595 'last_name' => 'xyz2',
596 'email-Primary' => 'abc2.xyz2@gmail.com',
597 'phone-1-1' => '022 321 826',
598 'country-1' => '1013',
599 'state_province-1' => '1000',
602 $result = $this->callAPIAndDocument('profile', 'apply', $params, __FUNCTION__
, __FILE__
);
604 // Expected field values
605 $expected['contact'] = array(
606 'contact_id' => $contactId,
607 'contact_type' => 'Individual',
608 'first_name' => 'abc2',
609 'last_name' => 'xyz2',
611 $expected['email'] = array(
612 'location_type_id' => 1,
614 'email' => 'abc2.xyz2@gmail.com',
617 $expected['phone'] = array(
618 'location_type_id' => 1,
620 'phone_type_id' => 1,
621 'phone' => '022 321 826',
623 $expected['address'] = array(
624 'location_type_id' => 1,
626 'country_id' => 1013,
627 'state_province_id' => 1000,
630 foreach ($expected['contact'] as $field => $value) {
631 $this->assertEquals($value, CRM_Utils_Array
::value($field, $result['values']), "In line " . __LINE__
. " error message: " . "missing/mismatching value for {$field}"
636 'email', 'phone', 'address') as $fieldType) {
637 $typeValues = array_pop($result['values'][$fieldType]);
638 foreach ($expected[$fieldType] as $field => $value) {
639 $this->assertEquals($value, CRM_Utils_Array
::value($field, $typeValues), "In line " . __LINE__
. " error message: " . "missing/mismatching value for {$field} ({$fieldType})"
646 * Helper function to create an Individual with address/email/phone info. Import UF Group and UF Fields
648 function _createIndividualContact($params = array()) {
649 $contactParams = array_merge(array(
650 'first_name' => 'abc1',
651 'last_name' => 'xyz1',
652 'email' => 'abc1.xyz1@yahoo.com',
653 'api.address.create' => array(
654 'location_type_id' => 1,
656 'street_address' => '5 Saint Helier St',
658 'country' => 'United States',
659 'state_province' => 'Michigan',
660 'supplemental_address_1' => 'Hallmark Ct',
661 'supplemental_address_2' => 'Jersey Village',
662 'postal_code' => '90210',
663 'city' => 'Gotham City',
666 'api.phone.create' => array(
667 'location_type_id' => '1',
668 'phone' => '021 512 755',
669 'phone_type_id' => '1',
675 $contactID = $this->individualCreate($contactParams);
676 $this->_createIndividualProfile();
677 // expected result of above created profile with contact Id $contactId
678 $profileData[$contactID] = array(
679 'first_name' => 'abc1',
680 'last_name' => 'xyz1',
681 'email-primary' => 'abc1.xyz1@yahoo.com',
682 'phone-1-1' => '021 512 755',
683 'country-1' => '1228',
684 'state_province-1' => '1021',
690 function _createContactWithActivity() {
691 // @TODO: Create profile with custom fields
692 $op = new PHPUnit_Extensions_Database_Operation_Insert();
693 $op->execute($this->_dbconn
,
694 new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(
695 dirname(__FILE__
) . '/dataset/uf_group_contact_activity_26.xml'
698 // hack: xml data set do not accept \ 1 (CRM_Core_DAO::VALUE_SEPARATOR)
699 CRM_Core_DAO
::setFieldValue('CRM_Core_DAO_UFGroup', '26', 'group_type', 'Individual,Contact,Activity' . CRM_Core_DAO
::VALUE_SEPARATOR
. 'ActivityType:1');
701 $sourceContactId = $this->individualCreate();
702 $contactParams = array(
703 'first_name' => 'abc1',
704 'last_name' => 'xyz1',
705 'contact_type' => 'Individual',
706 'email' => 'abc1.xyz1@yahoo.com',
707 'api.address.create' => array(
708 'location_type_id' => 1,
710 'name' => 'Saint Helier St',
712 'country' => 'United States',
713 'state_province' => 'Michigan',
714 'supplemental_address_1' => 'Hallmark Ct',
715 'supplemental_address_2' => 'Jersey Village',
719 $contact = $this->callAPISuccess('contact', 'create', $contactParams);
721 $keys = array_keys($contact['values']);
722 $contactId = array_pop($keys);
724 $this->assertEquals(0, $contact['values'][$contactId]['api.address.create']['is_error'], "In line " . __LINE__
. " error message: " . CRM_Utils_Array
::value('error_message', $contact['values'][$contactId]['api.address.create'])
727 $activityParams = array(
728 'source_contact_id' => $sourceContactId,
729 'assignee_contact_id' => $contactId,
730 'activity_type_id' => '1',
731 'subject' => 'Make-it-Happen Meeting',
732 'activity_date_time' => '20110316',
734 'location' => 'Pensulvania',
735 'details' => 'a test activity',
737 'priority_id' => '1',
739 $activity = $this->callAPISuccess('activity', 'create', $activityParams);
741 $activityValues = array_pop($activity['values']);
743 // valid parameters for above profile
744 $profileParams = array(
746 'contact_id' => $contactId,
747 'activity_id' => $activityValues['id'],
750 // expected result of above created profile
752 'first_name' => 'abc1',
753 'last_name' => 'xyz1',
754 'email-Primary' => 'abc1.xyz1@yahoo.com',
755 'activity_subject' => 'Make-it-Happen Meeting',
756 'activity_details' => 'a test activity',
757 'activity_duration' => '120',
758 'activity_date_time_time' => '12:00AM',
759 'activity_date_time' => '03/16/2011',
760 'activity_status_id' => '1',
763 return array($profileParams, $expected);
768 function _createIndividualProfile() {
770 // creating these via the api as we want to utilise & test the flushing of caches when fields created
773 $ufGroupParams = array(
774 'group_type' => 'Individual,Contact',// really we should remove this & test the ufField create sets it
775 'name' => 'test_individual_contact_profile',
776 'title' => 'Flat Coffee',
777 'api.uf_field.create' => array(
779 'field_name' => 'first_name',
781 'visibility' => 'Public Pages and Listings',
782 'field_type' => 'Individual',
783 //is_active = 1, is_view 0, weight SHOULD be set by api (& tested), ditto is_reserved 0
786 'field_name' => 'last_name',
788 'visibility' => 'Public Pages and Listings',
789 'field_type' => 'Individual',
792 'field_name' => 'email',
794 'visibility' => 'Public Pages and Listings',
795 'field_type' => 'Contact',
799 'field_name' => 'phone',
801 'visibility' => 'Public Pages and Listings',
802 'field_type' => 'Contact',
803 'location_type_id' => 1,
804 'phone_type_id' => 1,
808 'field_name' => 'country',
810 'visibility' => 'Public Pages and Listings',
811 'field_type' => 'Contact',
812 'location_type_id' => 1,
816 'field_name' => 'state_province',
818 'visibility' => 'Public Pages and Listings',
819 'field_type' => 'Contact',
820 'location_type_id' => 1,
821 'label' => 'State Province'
824 'field_name' => 'postal_code',
826 'field_type' => 'Contact',
827 'location_type_id' => 1,
828 'label' => 'State Province'
832 $profile = $this->callAPISuccess('uf_group', 'create', $ufGroupParams);
833 $this->_profileID
= $profile['id'];
836 function _addCustomFieldToProfile($profileID) {
837 $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__
, '');
838 $this->uFFieldCreate(array('uf_group_id' => $profileID, 'field_name' => 'custom_' . $ids['custom_field_id'], 'contact_type' => 'Contact'));