src/Context/Form/FormContext.php
public function radioAction($customized, $selector)
    {
        $field = $this->getWorkingElement()->findField($selector);
        $customized = (bool) $customized;

        if ($field !== null && !$customized) {
            $field->selectOption($field->getAttribute('value'));
            return;
        }

        // Find all labels of a radio button or only first, if it is not custom.
        foreach ($this->findLabels($selector) as $label) {
            // Check a custom label for visibility.
            if ($customized && !$label->isVisible()) {
                continue;
            }

            $label->click();
            return;
        }

        $this->throwNoSuchElementException($selector, $field);
    }
public function radioAction($customized, $selector)
    {
        $field = $this->getWorkingElement()->findField($selector);
        $customized = (bool) $customized;

        if ($field !== null && !$customized) {
            $field->selectOption($field->getAttribute('value'));
            return;
        }

        // Find all labels of a radio button or only first, if it is not custom.
        foreach ($this->findLabels($selector) as $label) {
            // Check a custom label for visibility.
            if ($customized && !$label->isVisible()) {
                continue;
            }

            $label->click();
            return;
        }

        $this->throwNoSuchElementException($selector, $field);
    }
public function radioAction ( $ customized , $ selector ) { $ field = $ this -> getWorkingElement ( ) -> findField ( $ selector ) ; $ customized = ( bool ) $ customized ; if ( $ field !== null && ! $ customized ) { $ field -> selectOption ( $ field -> getAttribute ( 'value' ) ) ; return ; } // Find all labels of a radio button or only first, if it is not custom. foreach ( $ this -> findLabels ( $ selector ) as $ label ) { // Check a custom label for visibility. if ( $ customized && ! $ label -> isVisible ( ) ) { continue ; } $ label -> click ( ) ; return ; } $ this -> throwNoSuchElementException ( $ selector , $ field ) ; }
This method was defined and used instead of "assertSelectRadioById",
because the field label can contain too long value and better to use
another selector instead of label.

@see MinkContext::assertSelectRadioById()

@param string $customized
Can be an empty string or " customized".
@param string $selector
Field selector.

@throws NoSuchElement
When radio button was not found.
@throws \Exception

@Given /^(?:|I )check the(| customized) "([^"]*)" radio button$/
This method was defined and used instead of assertSelectRadioById because the field label can contain too long value and better to use another selector instead of label .