You are here

public function TestSubContext::assertNotSeeRadioById in Panopoly 8.2

Same name and namespace in other branches
  1. 7 modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc \TestSubContext::assertNotSeeRadioById()

Asserts that a radio button is present.

@Then I should not see the radio button :field with the id :id @Then I should not see the radio button :field

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc, line 948
Provide Behat step-definitions for generic Panopoly tests.

Class

TestSubContext
Behat sub-context for Panopoly.

Code

public function assertNotSeeRadioById($field, $id = FALSE) {
  $escaper = new Escaper();
  $element = $this
    ->getSession()
    ->getPage();
  $radiobutton = $id ? $element
    ->findById($id) : $element
    ->find('named', [
    'radio',
    $escaper
      ->escapeLiteral($field),
  ]);
  if ($radiobutton !== NULL) {
    throw new \Exception(sprintf('The radio button with "%s" was found on the page %s', $id ? $id : $field, $this
      ->getSession()
      ->getCurrentUrl()));
  }
}