You are here

protected function AcquiaLiftWebTestBase::createOptionSet in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 tests/acquia_lift.test \AcquiaLiftWebTestBase::createOptionSet()
17 calls to AcquiaLiftWebTestBase::createOptionSet()
AcquiaLiftWebTestCampaignWizardReview::testReviewSubmit in tests/acquia_lift.test
Tests the submission of the review form which results in nested tests being created.
AcquiaLiftWebTestCampaignWizardReview::testReviewSubmitErrors in tests/acquia_lift.test
Tests the behavior of the review form when there are batch sync errors.
AcquiaLiftWebTestCampaignWizardReview::testReviewSubmitTargeting in tests/acquia_lift.test
Tests the review submission for a targeting only test.
AcquiaLiftWebTestCampaignWizardTargeting::testAdvancedTestSettings in tests/acquia_lift.test
Test the advanced test settings on the targeting page.
AcquiaLiftWebTestCampaignWizardTargeting::testAudienceAvailability in tests/acquia_lift.test
Verify that audience-style targeting is only available for Acquia Lift Target agents.

... See full list

File

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

Class

AcquiaLiftWebTestBase
@file Integration tests for Acquia Lift module.

Code

protected function createOptionSet($index, $optionData) {
  $option_set = array(
    'plugin' => $optionData['plugin'],
    'label' => 'Option Set ' . ($index + 1),
    'agent' => $optionData['agent'],
  );
  $options = array();
  $choice_ids = array();
  if (!isset($optionData['option_ids'])) {
    for ($j = 0; $j < $optionData['num_options']; $j++) {
      $option_id = personalize_generate_option_id($j);
      $choice_ids[] = $option_id;
      $options[$j] = array(
        'option_id' => $option_id,
        'option_label' => personalize_generate_option_label($j),
      );
    }
  }
  else {
    foreach ($optionData['option_ids'] as $i => $option_id) {
      $choice_ids[] = $option_id;
      $options[$i] = array(
        'option_id' => $option_id,
        'option_label' => personalize_generate_option_label($i),
      );
    }
  }
  $option_set['options'] = $options;
  $option_set = (object) $option_set;
  try {
    personalize_option_set_save($option_set);
  } catch (PersonalizeException $e) {
    $this
      ->fail('Exception thrown with message: . ' . $e
      ->getMessage());
  }
  return $option_set;
}