function SequentiallyConstraintValidatorTest::dataProvider
Data provider for testValidation().
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Validation/ SequentiallyConstraintValidatorTest.php, line 103
Class
- SequentiallyConstraintValidatorTest
- Tests Sequentially validation constraint with both valid and invalid values.
Namespace
Drupal\KernelTests\Core\ValidationCode
public static function dataProvider() : array {
return [
'fail on a failing sibling validator' => [
'integer',
150,
[
[
'Range' => [
'min' => 100,
],
],
[
'NotNull' => [],
],
],
[
'This value should be blank.',
],
[
'Blank' => [],
],
],
'fail if second validator fails' => [
'integer',
250,
[
[
'Range' => [
'min' => 100,
],
],
[
'AllowedValues' => [
'choices' => [
500,
],
],
],
],
[
'The value you selected is not a valid choice.',
],
],
'show first validation error only even when multiple would fail' => [
'string',
'Green',
[
[
'AllowedValues' => [
'choices' => [
'test',
],
],
],
[
'Blank' => [],
],
],
[
'The value you selected is not a valid choice.',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.