protected function AcquiaLiftWebTestBase::createPersonalizeElementsOptionSet in Acquia Lift Connector 7.2
Create personalize element option set.
3 calls to AcquiaLiftWebTestBase::createPersonalizeElementsOptionSet()
- AcquiaLiftWebTestCampaignWizardVariations::testWhatElementForm in tests/
acquia_lift.test - Test element variation set creation.
- AcquiaLiftWebTestTarget::testAgentEditableMessaging in tests/
acquia_lift.test - Tests messaging for available operations based on agent status.
- AcquiaLiftWebTestTarget::testLockstepVariations in tests/
acquia_lift.test
File
- tests/
acquia_lift.test, line 204 - Integration tests for Acquia Lift module.
Class
- AcquiaLiftWebTestBase
- @file Integration tests for Acquia Lift module.
Code
protected function createPersonalizeElementsOptionSet($agent_name, $option_data) {
$pages_link = isset($option_data['pages']) ? $option_data['pages'] : 'node';
$preview_link = isset($option_data['preview_link']) ? $option_data['preview_link'] : $pages_link;
$option_set = array(
'label' => isset($option_data['label']) ? $option_data['label'] : 'Element test set 1',
'plugin' => 'elements',
'agent' => $agent_name,
'executor' => 'personalizeElements',
'options' => array(),
'data' => array(
'personalize_elements_selector' => isset($option_data['selector']) ? $option_data['selector'] : '#some-selector',
'personalize_elements_type' => isset($option_data['type']) ? $option_data['type'] : 'editText',
'pages' => $pages_link,
),
'preview_link' => $preview_link,
);
if (!empty($option_data['add_control'])) {
$option_set['options'][] = array(
'option_label' => PERSONALIZE_CONTROL_OPTION_LABEL,
'option_id' => PERSONALIZE_CONTROL_OPTION_ID,
'personalize_elements_content' => '',
);
}
$num_options = empty($option_data['num_options']) ? 2 : $option_data['num_options'];
for ($i = 0; $i < $num_options; $i++) {
$option_set['options'][] = array(
'option_id' => personalize_generate_option_id($i),
'option_label' => personalize_generate_option_label($i),
'personalize_elements_content' => 'Generated content ' . ($i + 1),
);
}
return personalize_option_set_save((object) $option_set);
}