You are here

public function RestrictIpBrowserTestBase::assertRadioSelected in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/RestrictIpBrowserTestBase.php \Drupal\Tests\restrict_ip\Functional\RestrictIpBrowserTestBase::assertRadioSelected()
  2. 3.x tests/src/Functional/RestrictIpBrowserTestBase.php \Drupal\Tests\restrict_ip\Functional\RestrictIpBrowserTestBase::assertRadioSelected()
1 call to RestrictIpBrowserTestBase::assertRadioSelected()
RestrictIpAdminUiTest::testRestrictIpAdminPage in tests/src/Functional/RestrictIpAdminUiTest.php
* Test that the admin UI page is properly linked to, that all the required elements * exist, and that the form is working properly

File

tests/src/Functional/RestrictIpBrowserTestBase.php, line 45

Class

RestrictIpBrowserTestBase
Provides some helper functions for functional tests.

Namespace

Drupal\Tests\restrict_ip\Functional

Code

public function assertRadioSelected($htmlID) {
  if (!preg_match('/^#/', $htmlID)) {
    $htmlID = '#' . $htmlID;
  }
  $selected_radio = $this
    ->getSession()
    ->getPage()
    ->find('css', 'input[type="radio"]:checked' . $htmlID);
  if (!$selected_radio) {
    throw new \Exception('Radio button with ID ' . $htmlID . ' is not selected');
  }
}