Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] FormValidator removed code related to removedcascade_validation option#18081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
peterrehm commentedMar 9, 2016
| Q | A |
|---|---|
| Branch | 3.0 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #18063 |
| License | MIT |
peterrehm commentedMar 9, 2016
Args, should be merged into 3.0. |
peterrehm commentedMar 9, 2016
I see some tests are failing, but only with some deps versions. Does anyone have a hint in this regards? |
peterrehm commentedMar 9, 2016
sustmi commentedMar 9, 2016
I would rename:
and |
peterrehm commentedMar 10, 2016
Updated, just the PHP 7 test with the low deps fails, is this maybe due to subtree split or so? |
| } | ||
| publicfunctiontestDontValidateIfParentWithoutCascadeValidation() | ||
| publicfunctiontestDontValidateIfParentWithoutValidConstraint() |
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.
Do we still need these tests? Don't they duplicate other tests here?
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.
I am not sure, I thought it might be intended as it looks like the test for an explizit cascade without the option/constraint.
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.
I'd appreciate if you could check the other test cases whether any of them duplicates this one. If that's the case, we can safely remove this. This was mainly designed in order to test the special treatment of thecascade_validation option.
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.
From my understanding it looks like it is not duplicated as we have the related tests
- testValidateConstraintsEvenIfNoValidConstraint
- testValidateIfChildWithValidConstraint
- testDontValidateIfParentWithoutValidConstraint
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.
Let me phrase this another way: Is there any way to make these two tests fail (individually)without making at least one other test in this test class fail at the same time?
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.
Seems so, but I am actually a bit confused about the difference oftestValidateConstraintsEvenIfNoValidConstraint andtestDontValidateIfParentWithoutValidConstraint as it looks like in the first tests constraints in the child are validated even when there is no Valid constraint.
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.
@peterrehm I guess the naming of the tests is confusing. We have two different cases:
- the
constraintsoption: Constraints set in this option arealways validated (given their groups match). - the
Validconstraint: This constraint (either set in the validation metadata - e.g. as annotation - or in theconstraintsoption) results in the constraints defined ine the metadata of thedata being validated.
Example:
// data_class = Customer$form->add('address', FormType::class);$form->get('address')->add('street', TextType::class, ['constraints' =>newNotBlank(),]);class Customer{private$address;}class Address{/** * @Length(min=3) */private$street;}
In this example, by default only theNotBlank constraint is validated. The constraints defined in theAddress class, however, are not validated:
- There is no
Validconstraint in theconstraintsoption of theaddressfield in the form. - There is no
Validconstraint on theCustomer::$addressproperty.
If you add theValid constraint in either of these places, theLength constraint is validated as well.
We could clarify the tests for example by renamingtestValidateConstraintsEvenIfNoValidConstraint totestValidateConstraintsOptionEvenIfParentWithoutValidConstraint etc.
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.
Looks better! Could you name the three tests for the Valid constraint consistently?
- testValidateChildIfValidConstraint
- testDontValidateChildIfNoValidConstraint
- testValidateConstraintsOptionEvenIfNoValidConstraint
peterrehm commentedMar 16, 2016
Any further feedback? |
Tobion commentedMar 19, 2016
👍 to be merged in 3.0 Status: Reviewed |
sustmi commentedMar 19, 2016
After re-reading the tests I came to the following conclusions:
EDIT: AddedbyFormConstraints into the new test names as there is a difference between validating form data by constraints defined in form and constraints defined on the class of the form data object. |
peterrehm commentedMar 29, 2016
@webmozart Updated. |
webmozart commentedApr 1, 2016
👍 apart from my last remark |
peterrehm commentedApr 3, 2016
@webmozart: Updated, I hope it is as per your request. |
xabbuh commentedApr 4, 2016
Looks like you need to fix the tests: |
peterrehm commentedApr 4, 2016
Updated. |
fabpot commentedApr 7, 2016
Thank you@peterrehm. |
…ade_validation` option (peterrehm)This PR was submitted for the master branch but it was merged into the 3.0 branch instead (closes#18081).Discussion----------[Form] FormValidator removed code related to removed `cascade_validation` option| Q | A| ------------- | ---| Branch | 3.0| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#18063| License | MITCommits-------05fe6f9 [Form] FormValidator removed code related to removed option