You are here

public function ForcePasswordChangeBrowserTestBase::assertRadioSelected in Force Password Change 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/ForcePasswordChangeBrowserTestBase.php \Drupal\Tests\force_password_change\Functional\ForcePasswordChangeBrowserTestBase::assertRadioSelected()
1 call to ForcePasswordChangeBrowserTestBase::assertRadioSelected()
ForcePasswordChangeAdminUiTest::testForcePasswordChangeAdminPage in tests/src/Functional/ForcePasswordChangeAdminUiTest.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/ForcePasswordChangeBrowserTestBase.php, line 98

Class

ForcePasswordChangeBrowserTestBase
Provides some helper functions for functional tests.

Namespace

Drupal\Tests\force_password_change\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');
  }
}