You are here

public function FeatureContext::theRadioShouldBeChecked in Bear 8

Same name and namespace in other branches
  1. 8.2 tests/features/bootstrap/FeatureContext.php \FeatureContext::theRadioShouldBeChecked()
  2. 7.2 tests/features/bootstrap/FeatureContext.php \FeatureContext::theRadioShouldBeChecked()

Checks that a specific radio button is checked, must use radio button's id.

@Then /^the "([^"]*)" radio should be checked$/

File

tests/features/bootstrap/FeatureContext.php, line 78

Class

FeatureContext
Defines application features from the specific context.

Code

public function theRadioShouldBeChecked($arg1) {
  $elementByCss = $this
    ->getSession()
    ->getPage()
    ->find('css', 'input[type="radio"]:checked#' . $arg1);
  if (!$elementByCss) {
    throw new Exception('Radio button with id ' . $arg1 . ' is not checked');
  }
}