You are here

public function FeatureContext::createTargeting in Acquia Lift Connector 7.2

@Given /^targeting:$/

File

behat-tests/features/bootstrap/FeatureContext.php, line 310

Class

FeatureContext
Defines application features from the specific context.

Code

public function createTargeting(TableNode $targetingTable) {
  module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');
  $targeting = array();
  foreach ($targetingTable
    ->getHash() as $targetingHash) {
    $targeting[$targetingHash['agent']][$targetingHash['audience']] = explode(',', $targetingHash['options']);
  }
  foreach ($targeting as $agent => $agent_targeting) {
    $agent_data = personalize_agent_load($agent);
    acquia_lift_save_targeting_structure($agent_data, $agent_targeting);
  }
}