public function DurationFieldBrowserTestBase::assertRadioSelected in Duration Field 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/DurationFieldBrowserTestBase.php \Drupal\Tests\duration_field\Functional\DurationFieldBrowserTestBase::assertRadioSelected()
- 3.0.x tests/src/Functional/DurationFieldBrowserTestBase.php \Drupal\Tests\duration_field\Functional\DurationFieldBrowserTestBase::assertRadioSelected()
Asserts that the value of a radio element was selected.
File
- tests/
src/ Functional/ DurationFieldBrowserTestBase.php, line 57
Class
- DurationFieldBrowserTestBase
- Base class that provides some helper functions for functional tests.
Namespace
Drupal\Tests\duration_field\FunctionalCode
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');
}
}