function ElementsTableSelectTest::testMultipleFalseOptionchecker in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Form/ElementsTableSelectTest.php \Drupal\system\Tests\Form\ElementsTableSelectTest::testMultipleFalseOptionchecker()
Test the whether the option checker gives an error on invalid tableselect values for radios.
File
- core/
modules/ system/ src/ Tests/ Form/ ElementsTableSelectTest.php, line 177 - Contains \Drupal\system\Tests\Form\ElementsTableSelectTest.
Class
- ElementsTableSelectTest
- Tests the tableselect form element for expected behavior.
Namespace
Drupal\system\Tests\FormCode
function testMultipleFalseOptionchecker() {
list($header, $options) = _form_test_tableselect_get_data();
$form['tableselect'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#multiple' => FALSE,
);
// Test with a valid value.
list(, , $errors) = $this
->formSubmitHelper($form, array(
'tableselect' => 'row1',
));
$this
->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for radio buttons.');
// Test with an invalid value.
list(, , $errors) = $this
->formSubmitHelper($form, array(
'tableselect' => 'non_existing_value',
));
$this
->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.');
}