public function FeatureContext::assertMenuCount in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 behat-tests/features/bootstrap/FeatureContext.php \FeatureContext::assertMenuCount()
@Then I should see :count for the :type count
File
- behat-tests/features/ bootstrap/ FeatureContext.php, line 250 
Class
- FeatureContext
- Defines application features from the specific context.
Code
public function assertMenuCount($count, $type) {
  switch ($type) {
    case 'variation':
    case 'variation set':
      $region_name = 'lift_tray_variation_count';
      break;
    case 'goal':
      $region_name = 'lift_tray_goal_count';
      break;
    default:
      throw new \Exception(sprintf('The count type %s is not supported.', $type));
  }
  $regions = $this
    ->getRegions($region_name);
  foreach ($regions as $current) {
    if ($current
      ->isVisible()) {
      $region = $current;
      break;
    }
  }
  if (empty($region)) {
    throw new \Exception(sprintf('There is no visible goal region'));
  }
  $actual_count = $region
    ->getText();
  if ($actual_count !== $count) {
    throw new \Exception(sprintf('The count for type %s was %s rather than the expected %s.', $type, $actual_count, $count));
  }
}