function FormValidatorTest::providerTestPerformRequiredValidation
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestPerformRequiredValidation()
- 10 core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestPerformRequiredValidation()
- 11.x core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestPerformRequiredValidation()
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormValidatorTest.php, line 400
Class
- FormValidatorTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormValidator.php/class/FormValidator/9" title="Provides validation of form submissions." class="local">\Drupal\Core\Form\FormValidator</a> @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.