You are here

public function FeatureContext::assertMenuItemInactive in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 behat-tests/features/bootstrap/FeatureContext.php \FeatureContext::assertMenuItemInactive()

@Given /^menu item "([^"]*)" should be "(active|inactive)"$/

File

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

Class

FeatureContext
Defines application features from the specific context.

Code

public function assertMenuItemInactive($link, $status) {
  $class = 'acquia-lift-menu-disabled';
  $element = $this
    ->findLinkInRegion($link, 'lift_tray');
  if (empty($element)) {
    throw new \Exception(sprintf('The link element %s was not found on the page %s', $link, $this
      ->getSession()
      ->getCurrentUrl()));
  }
  if ($element
    ->hasClass($class)) {
    if ($status === 'active') {
      throw new \Exception(sprintf('The link element %s on page %s is inactive but should be active.', $link, $this
        ->getSession()
        ->getCurrentUrl()));
    }
  }
  else {
    if ($status === 'inactive') {
      throw new \Exception(sprintf('The link element %s on page %s is active but should be inactive.', $link, $this
        ->getSession()
        ->getCurrentUrl()));
    }
  }
}