-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Hardened test suite for empty data #29179
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0f2ae2d
to
6430cf0
Compare
6430cf0
to
b0dab62
Compare
$form->submit(null); | ||
|
||
// view data is transformed to the string true value | ||
$this->assertSame('1', $form->getViewData()); |
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.
This test is a bit confusing, why do we receive 1
here when the empty_data
is set to empty
?
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.
We can define any true value as empty data as long as the view transformer supports it as input of reverseTransform
. In any case it will transform back the norm data to view data, so we end up with '1'
which is the default output of transform
.
The same happens for any type using a transformer (almost all those overriding the base one).
If we actually define entries in empty data arrays of date types or RepeatedType
we get the exact same result due to the transformation process.
Thank you @HeahDude. |
This PR was merged into the 2.8 branch. Discussion ---------- [Form] Hardened test suite for empty data | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | # | License | MIT | Doc PR | ~ Finally the continuation of #21877, giving some more love to 2.8 before it is not maintained anymore <3. Commits ------- b0dab62 [Form] Hardened test suite for empty data
Finally the continuation of #21877, giving some more love to 2.8 before it is not maintained anymore <3.