You are here

protected function ALProfilesWebTest::createUserProfileField in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift_profiles/tests/acquia_lift_profiles.test \ALProfilesWebTest::createUserProfileField()

Creates a user profile field which can be used for targeting.

Return value

array An associative array representing the field.

2 calls to ALProfilesWebTest::createUserProfileField()
ALProfilesWebTest::testFieldMappings in acquia_lift_profiles/tests/acquia_lift_profiles.test
ALProfilesWebTest::testUDFMappings in acquia_lift_profiles/tests/acquia_lift_profiles.test

File

acquia_lift_profiles/tests/acquia_lift_profiles.test, line 508
Tests for Acquia Lift Profiles module.

Class

ALProfilesWebTest
Tests Acquia Lift Profiles functionality.

Code

protected function createUserProfileField($field_name = NULL) {
  $field_name = empty($field_name) ? $this
    ->randomName() : $field_name;
  $field = array(
    'field_name' => 'field_' . drupal_strtolower($field_name),
    'type' => 'text',
    'cardinality' => 1,
  );
  field_create_field($field);
  $fieldInstance = array(
    'field_name' => $field['field_name'],
    'entity_type' => 'user',
    'bundle' => 'user',
    'settings' => array(
      'user_register_form' => FALSE,
    ),
  );
  field_create_instance($fieldInstance);
  return $field;
}