function FormValidatorTest::providerTestPerformRequiredValidation
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormValidatorTest.php, line 400
Class
- FormValidatorTest
- @coversDefaultClass \Drupal\Core\Form\FormValidator[[api-linebreak]] @group Form
Namespace
Drupal\Tests\Core\FormCode
public function providerTestPerformRequiredValidation() {
return [
[
[
'#type' => 'select',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#required' => TRUE,
'#value' => 'baz',
'#empty_value' => 'baz',
'#multiple' => FALSE,
],
'Test field is required.',
FALSE,
],
[
[
'#type' => 'select',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#value' => 'baz',
'#multiple' => FALSE,
],
'An illegal choice has been detected. Please contact the site administrator.',
TRUE,
],
[
[
'#type' => 'checkboxes',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#value' => [
'baz',
],
'#multiple' => TRUE,
],
'An illegal choice has been detected. Please contact the site administrator.',
TRUE,
],
[
[
'#type' => 'select',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#value' => [
'baz',
],
'#multiple' => TRUE,
],
'An illegal choice has been detected. Please contact the site administrator.',
TRUE,
],
[
[
'#type' => 'textfield',
'#maxlength' => 7,
'#value' => $this->randomMachineName(8),
],
'Test cannot be longer than <em class="placeholder">7</em> characters but is currently <em class="placeholder">8</em> characters long.',
FALSE,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.