function FormValidatorTest::providerTestPerformRequiredValidation
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestPerformRequiredValidation()
- 8.9.x 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 \Drupal\Core\Form\FormValidator @group Form
Namespace
Drupal\Tests\Core\FormCode
public static 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,
],
'The submitted value <em class="placeholder">baz</em> in the <em class="placeholder">Test</em> element is not allowed.',
TRUE,
],
[
[
'#type' => 'checkboxes',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#value' => [
'baz',
],
'#multiple' => TRUE,
],
'The submitted value <em class="placeholder">0</em> in the <em class="placeholder">Test</em> element is not allowed.',
TRUE,
],
[
[
'#type' => 'select',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#value' => [
'baz',
],
'#multiple' => TRUE,
],
'The submitted value <em class="placeholder">baz</em> in the <em class="placeholder">Test</em> element is not allowed.',
TRUE,
],
[
[
'#type' => 'textfield',
'#maxlength' => 7,
'#value' => Random::machineName(8),
],
'Test cannot be longer than <em class="placeholder">7</em> characters but is currently <em class="placeholder">8</em> characters long.',
FALSE,
],
[
[
'#type' => 'select',
'#options' => [
'foo' => 'Foo',
'bar' => 'Bar',
],
'#value' => [
[],
],
'#multiple' => TRUE,
],
'The submitted value type <em class="placeholder">array</em> in the <em class="placeholder">Test</em> element is not allowed.',
TRUE,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.