You are here

public function FeatureContext::assignVariationFromUnassigned in Acquia Lift Connector 7.2

@When I move the :variation variation to the :audience audience

File

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

Class

FeatureContext
Defines application features from the specific context.

Code

public function assignVariationFromUnassigned($variation, $audience) {
  $variation_element = $this
    ->getAssignableVariation($variation);
  $to_audience_element = $this
    ->getAudienceElement($audience);
  if (empty($variation_element)) {
    throw new \Exception(sprintf('Cannot find variation "%s" in available options.', $variation));
  }
  if (empty($to_audience_element)) {
    throw new \Exception(sprintf('Cannot find audience "%s" to move variation to.', $audience));
  }
  $to_audience_drop_zone = $to_audience_element
    ->find('css', '.acquia-lift-targeting-droppable');
  if (empty($to_audience_drop_zone)) {
    throw new \Exception(sprintf('Cannot find drop zone for audience "%s".', $audience));
  }
  $variation_element
    ->dragTo($to_audience_drop_zone);
}