public function FeatureContext::setCampaignStatus in Acquia Lift Connector 7.2
@Given /^the "([^"]*)" personalization has the "([^"]*)" status$/
File
- behat-tests/
features/ bootstrap/ FeatureContext.php, line 199
Class
- FeatureContext
- Defines application features from the specific context.
Code
public function setCampaignStatus($agent_name, $status_name) {
$statuses = personalize_get_agent_status_map();
$status = array_search($status_name, $statuses);
if ($status === FALSE) {
throw new \Exception(sprintf('Status %s is invalid.', $status_name));
}
$agent = personalize_agent_load($agent_name);
if ($agent->plugin == 'acquia_lift_target') {
module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');
// Implement the targeting before changing the status.
$agent_data = personalize_agent_load($agent_name);
acquia_lift_implement_targeting($agent_data);
}
personalize_agent_set_status($agent_name, $status);
}