Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Nov 11, 2018

Conversation

HeahDude
Copy link
Contributor

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.

@xabbuh xabbuh added this to the 2.8 milestone Nov 11, 2018
$form->submit(null);

// view data is transformed to the string true value
$this->assertSame('1', $form->getViewData());
Copy link
Member

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?

Copy link
Contributor Author

@HeahDude HeahDude Nov 11, 2018

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.

@nicolas-grekas
Copy link
Member

Thank you @HeahDude.

@nicolas-grekas nicolas-grekas merged commit b0dab62 into symfony:2.8 Nov 11, 2018
nicolas-grekas added a commit that referenced this pull request Nov 11, 2018
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
@HeahDude HeahDude deleted the test-empty-data branch November 11, 2018 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants