public function DurationFieldBrowserTestBase::selectRadio in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/DurationFieldBrowserTestBase.php \Drupal\Tests\duration_field\Functional\DurationFieldBrowserTestBase::selectRadio()
- 8 tests/src/Functional/DurationFieldBrowserTestBase.php \Drupal\Tests\duration_field\Functional\DurationFieldBrowserTestBase::selectRadio()
Selects a given radio element.
File
- tests/
src/ Functional/ DurationFieldBrowserTestBase.php, line 43
Class
- DurationFieldBrowserTestBase
- Base class that provides some helper functions for functional tests.
Namespace
Drupal\Tests\duration_field\FunctionalCode
public function selectRadio($htmlID) {
if (preg_match('/^#/', $htmlID)) {
$htmlID = substr($htmlID, 1);
}
$radio = $this
->getSession()
->getPage()
->findField($htmlID);
$name = $radio
->getAttribute('name');
$option = $radio
->getAttribute('value');
$this
->getSession()
->getPage()
->selectFieldOption($name, $option);
}