Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Add docs to register custom form extensions and types for unit testing#7578
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
form/unit_testing.rst Outdated
| If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to | ||
| register the validation extension which provides this options. | ||
| Luckily Symfony provides a custom test class which does this for you. | ||
| In order to have this option registered, your test needs to extend from the |
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.
to extend the .. class would be better, no ? (Without from)
form/unit_testing.rst Outdated
| } | ||
| Forms Using Validation | ||
| ------------------------------------ |
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.
please keep the underline as long as the title
| } | ||
| It is also possible to load custom form types, form type extensions or type guessers using the | ||
| ``getTypedExtensions``, ``getTypes`` and ``getTypeGuessers`` methods. |
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 should be part of a separate pull request as we will have to merge it into themaster branch (the rest can be merged into the docs for Symfony 2.7).
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.
One thing I forgot: Can you also add aversionadded directive that mentions the introduction of the new methods?
…ons during unit testing (pierredup)This PR was squashed before being merged into the 3.3-dev branch (closes#21780).Discussion----------[DX] [Form] Add helper method to register form extensions during unit testing| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | N/A| License | MIT| Doc PR |symfony/symfony-docs#7578Add helper method to register form extensions during unit testing, so it's easier to register custom form type extensions, form types, or type guessersCommits-------bab562a [DX] [Form] Add helper method to register form extensions during unit testing
…ons during unit testing (pierredup)This PR was squashed before being merged into the 3.3-dev branch (closes #21780).Discussion----------[DX] [Form] Add helper method to register form extensions during unit testing| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | N/A| License | MIT| Doc PR |symfony/symfony-docs#7578Add helper method to register form extensions during unit testing, so it's easier to register custom form type extensions, form types, or type guessersCommits-------bab562a987 [DX] [Form] Add helper method to register form extensions during unit testing
HeahDude left a comment
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.
Thanks for that PR! Can you please separate the changes as@xabbuh asked?
form/unit_testing.rst Outdated
| Forms Using Validation | ||
| ---------------------- | ||
| If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to |
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.
It should either beIf your form uses orIf your forms use.
form/unit_testing.rst Outdated
| ---------------------- | ||
| If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to | ||
| register the validation extension which provides this options. |
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 =>these
form/unit_testing.rst Outdated
| If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to | ||
| register the validation extension which provides this options. | ||
| Luckily Symfony provides a custom test class which does this for you. |
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 would suggestLuckily Symfony provides a base test class which takes care of it, just extend [class].
And get rid of the following sentence, what do you think?
form/unit_testing.rst Outdated
| :class:`Symfony\\Component\\Form\\Tests\\Extension\\Validator\\Type\\TypeTestCase` | ||
| class:: | ||
| // tests/AppBundle/Form/Type/TestedTypeTests.php |
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.
Please remove the lasts inTestedTypeTest.php.
pierredup commentedMar 7, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I created a separate PR for 2.7#7587. When that is merged, it should squash this diff to only leave the sentence for the new methods addedsymfony/symfony#21780 (I'll just resolve any conflicts there might be after that PR is merged) |
pierredup commentedMar 8, 2017
I removed the validator extension part in this docs, so it's not dependent on other changes, and can be merged to document the new methods added |
form/unit_testing.rst Outdated
| ``getTypedExtensions``, ``getTypes`` and ``getTypeGuessers`` methods. | ||
| ..versionadded::3.3 | ||
| The ``getTypedExtensions``, ``getTypes`` and ``getTypeGuessers`` was introduced in Symfony 3.3. |
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.
"The [...] methods were introduced [...]."
HeahDude left a comment
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.
👍
xabbuh commentedApr 15, 2017
Thank you@pierredup. FYI, I have taken the proposed changes fromsymfony/symfony#22445 taken into account in68bcaa0. |
Uh oh!
There was an error while loading.Please reload this page.
Docs forsymfony/symfony#21780 to register custom extensions and types