You are here

private function FeatureContext::getAssignableVariation in Acquia Lift Connector 7.2

Helper function to retrieve a specific variation from the available variations list.

Parameters

$variation: The label of the variation

Throws

Exception If the variation is not available within the available variations.

1 call to FeatureContext::getAssignableVariation()
FeatureContext::assignVariationFromUnassigned in behat-tests/features/bootstrap/FeatureContext.php
@When I move the :variation variation to the :audience audience

File

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

Class

FeatureContext
Defines application features from the specific context.

Code

private function getAssignableVariation($variation) {
  $variations_list = $this
    ->findElementInRegion('.form-item-variations-options-assignment', 'campaign_workflow_form');
  if (empty($variations_list)) {
    throw new \Exception('Could not find the variations bucket area for all variations.');
  }
  $variation_items = $variations_list
    ->findAll('css', '.acquia-lift-draggable-variations li');
  foreach ($variation_items as $variation_element) {
    $variation_list_item = $variation_element
      ->getText();
    if (strpos($variation_list_item, $variation) === 0) {
      return $variation_element;
    }
  }
  return NULL;
}