This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Implement expected Input::isValid workflow #7474
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ql-process-expression Get correct expression string when Zend\Db\Sql\Expression is used
…xpression Test for percentage sign in Zend\Db\Sql\Expression
Fixes zendframework#7407 Close zendframework#7422 Close zendframework#7423
…r-input-random-specs-order Allow use of setRequired() at different positions
This patch clarifies the interaction of the various flags when validating an input. In it, I added test cases for the various behaviors - `required === true` + `allow_empty === true` + `continue_if_empty === false` -> validators are NOT run - `required === true` + `allow_empty === true` + `continue_if_empty === true` -> validators are run - `required === false` + `allow_empty === true` + `continue_if_empty === false` -> validators are NOT run - `required === false` + `allow_empty === true` + `continue_if_empty === true` -> validators are run - `required === false` + `allow_empty === false` + `continue_if_empty === false` -> validators are NOT run - `required === false` + `allow_empty === false` + `continue_if_empty === true` -> validators are run Changes were applied to `setRequired()`, which now no longer toggles `allow_empty`, and the logic in `Input::isValid()` and `FileInput::isValid()` was updated to match the above. Two tests were removed as they were testing false assumptions: - `BaseInputFilterTest::testValidationMarksInputInvalidWhenNotRequiredAndAllowEmptyFlagIsFalse` - `FactoryTest::testFactoryWillCreateInputWithSuggestedRequiredFlagAndImpliesAllowEmptyFlag`
- `required === true` + `allow_empty === false` + `continue_if_empty === false` -> validators are NOT run - `required === true` + `allow_empty === false` + `continue_if_empty === true` -> validators are run
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch implements the logic I outlined in a comment to #7448:
required === true
+allow_empty === true
+continue_if_empty === false
-> validators are NOT runrequired === true
+allow_empty === true
+continue_if_empty === true
-> validators are runrequired === true
+allow_empty === false
+continue_if_empty === false
-> validators are NOT runrequired === true
+allow_empty === false
+continue_if_empty === true
-> validators are runrequired === false
+allow_empty === true
+continue_if_empty === false
-> validators are NOT runrequired === false
+allow_empty === true
+continue_if_empty === true
-> validators are runrequired === false
+allow_empty === false
+continue_if_empty === false
-> validators are NOT runrequired === false
+allow_empty === false
+continue_if_empty === true
-> validators are runIt builds on the patch of #7448, and addresses the BC break demonstrated in #7445 and in zfcampus/zf-content-validation#46.