protected function AcquiaLiftWebTestTarget::createTargetAudience in Acquia Lift Connector 7
Helper that adds a target audience using two contexts AND'd together.
Parameters
$option_set:
null $machine_name:
Return value
null|string
2 calls to AcquiaLiftWebTestTarget::createTargetAudience()
File
- tests/
acquia_lift.test, line 3592 - Integration tests for Acquia Lift module.
Class
Code
protected function createTargetAudience($option_set, $machine_name = NULL, $contexts = array()) {
if (empty($machine_name)) {
$label = $this
->randomName();
$machine_name = personalize_generate_machine_name($label, NULL, '-');
}
if (empty($contexts)) {
$contexts = array(
array(
'context' => implode(PERSONALIZE_TARGETING_ADMIN_SEPARATOR, array(
'some_plugin',
'some_context',
)),
'operator' => 'contains',
'match' => 'ohai',
),
array(
'context' => implode(PERSONALIZE_TARGETING_ADMIN_SEPARATOR, array(
'some_plugin',
'some_other_context',
)),
'operator' => 'starts',
'match' => 'stuff',
),
);
}
module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');
acquia_lift_target_audience_save($machine_name, $option_set->agent, $contexts, 'AND');
$this
->resetAll();
return $machine_name;
}