-
Notifications
You must be signed in to change notification settings - Fork 47
Provide NotEmpty::IS_EMPTY validation message for required input #61
Conversation
…s-set Not set default required error message always
- `getMessages()` is expected to return the `NotEmpty::IS_EMPTY` message template.
test/InputTest.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about assertAttributeEquals
- Updates the test case to create an assertion method; the method now uses
`getOption('messageTemplates')` instead of reflection to be less brittle, and
is used in two separate test methods.
- Updated `Input` to add a `prepareRequiredValidationFailureMessage()` method
taht creates the required message format. Each of `Input`, `ArrayInput`, and
`FileInput` now assign the return of that method to the `$errorMessage`
property directly.
|
Following the reasoning of to restore the |
- In each case, this should be the only message; use `assertSame()`.
I consider this a stop-gap, as we'll be removing it (as we've deprecated this use case with earlier patches). As such, we're just trying to mimic previous behavior at this point. |
|
This part is not deprecated (still smelling of new) so this could be reused in future developments. The API suggested should be reused on v3. I found this way does not allow customization through input specifications. |
Includes these changes: - [14: NotEmpty validator doesn't override the required attribute](zendframework/zend-inputfilter#14) - [16: BC in validators context value](zendframework/zend-inputfilter#16) - [24: Fix loop validation input context is mutable](zendframework/zend-inputfilter#24) - [25: Fix missing optional fields should not be validated](zendframework/zend-inputfilter#25) - [26: Deprecate magic logic for auto attaching a NonEmpty validator with breakChainOnFailure = true](zendframework/zend-inputfilter#26) - [31: Update the InputFilterInterface::add docblock to match existing, shipped implementations](zendframework/zend-inputfilter#31) - [36: Fix docblocks declared as regular comment block](zendframework/zend-inputfilter#36) - [40: Remove test about Input setters permutation](zendframework/zend-inputfilter#40) - [41: Refactor tests for group 7448 as a data set matrix](zendframework/zend-inputfilter#41) - [42: Consolidate InputFilterPluginManager tests](zendframework/zend-inputfilter#42) - [43: Consolidate Factory tests + Fixes](zendframework/zend-inputfilter#43) - [44: Consolidate of InputInterface::merge and Fix unsafe merge](zendframework/zend-inputfilter#44) - [45: When merge Inputs don't merge values if source does not have one.](zendframework/zend-inputfilter#45) - [46: Expand test matrix with nonempty value scenarios](zendframework/zend-inputfilter#46) - [47: Feature/minor test improvements](zendframework/zend-inputfilter#47) - [48: Empty values + Allow Empty + Not continue if empty is always true](zendframework/zend-inputfilter#48) - [49: Add tests for exceptions and improve some messages](zendframework/zend-inputfilter#49) - [50: Optional fields without value should be valid ](zendframework/zend-inputfilter#50) - [51: Optional input without value are valid](zendframework/zend-inputfilter#51) - [52: Fix merge two inputs without value, result 'has value' flag should be false](zendframework/zend-inputfilter#52) - [56: Hotfix/minor changes](zendframework/zend-inputfilter#56) - [57: Consolidate tests for InputFilterInterface](zendframework/zend-inputfilter#57) - [61: Provide NotEmpty::IS_EMPTY validation message for required input](zendframework/zend-inputfilter#61) - [63: Ensure custom error messages are used for required missing inputs](zendframework/zend-inputfilter#63) - [64: Feature/test cleanup](zendframework/zend-inputfilter#64)
Per #28, since 2.4, we've not been returning error messages in the expected format when a value is required but no value (or an empty value) was provided for the input.
This patch builds on #60, and update the test expectations to those reported in #28.