public function FeatureContext::createAudiences in Acquia Lift Connector 7.2
@Given /^audiences:$/
File
- behat-tests/
features/ bootstrap/ FeatureContext.php, line 294
Class
- FeatureContext
- Defines application features from the specific context.
Code
public function createAudiences(TableNode $elementsTable) {
module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');
foreach ($elementsTable
->getHash() as $audienceHash) {
$audience = (object) $audienceHash;
$label = $audience->label;
$agent_name = $audience->agent;
$context_values = empty($audience->context) ? array() : $this
->convertContexts(explode(',', $audience->context));
$weight = isset($audience->weight) ? $audience->weight : 50;
$strategy = isset($audience->strategy) ? $audience->strategy : 'OR';
acquia_lift_target_audience_save($label, $agent_name, $context_values, $strategy, $weight);
}
}