You are here

protected function AcquiaLiftWebTestBase::createUserProfileField in Acquia Lift Connector 7.2

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

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

Return value

array An associative array representing the field.

4 calls to AcquiaLiftWebTestBase::createUserProfileField()
AcquiaLiftWebTestCampaignWizardReview::testReviewSubmitTargeting in tests/acquia_lift.test
Tests the review submission for a targeting only test.
AcquiaLiftWebTestCampaignWizardTargeting::testNoTargeting in tests/acquia_lift.test
Test doing a straight test, i.e. all variations assigned to "Everyone Else".
AcquiaLiftWebTestCampaignWizardTargeting::testTargeting in tests/acquia_lift.test
Test the audience functionality.
AcquiaLiftWebTestCampaignWizardTargeting::testWinnerSelectionAvailability in tests/acquia_lift.test

File

tests/acquia_lift.test, line 244
Integration tests for Acquia Lift module.

Class

AcquiaLiftWebTestBase
@file Integration tests for Acquia Lift module.

Code

protected function createUserProfileField($field_name = NULL) {
  $field_name = $field_name ?: $this
    ->randomName();
  $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;
}