function ElementsTableSelectTest::testMultipleFalseOptionchecker
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleFalseOptionchecker()
- 10 core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleFalseOptionChecker()
- 11.x core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php \Drupal\Tests\system\Functional\Form\ElementsTableSelectTest::testMultipleFalseOptionChecker()
Tests error handling for invalid tableselect values with radio buttons.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ElementsTableSelectTest.php, line 178
Class
- ElementsTableSelectTest
- Tests the tableselect form element for expected behavior.
Namespace
Drupal\Tests\system\Functional\FormCode
public function testMultipleFalseOptionchecker() {
[
$header,
$options,
] = _form_test_tableselect_get_data();
$form['tableselect'] = [
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#multiple' => FALSE,
];
// Test with a valid value.
[
,
,
$errors,
] = $this->formSubmitHelper($form, [
'tableselect' => 'row1',
]);
$this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for radio buttons.');
// Test with an invalid value.
[
,
,
$errors,
] = $this->formSubmitHelper($form, [
'tableselect' => 'non_existing_value',
]);
$this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.