Skip to content

Add FormLayoutTestCase class #18981

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
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,18 @@ guessers using the :method:`Symfony\\Component\\Form\\Test\\FormIntegrationTestC
and :method:`Symfony\\Component\\Form\\Test\\FormIntegrationTestCase::getTypeGuessers`
methods.

If you want to test the themes of your forms, you may want to make your test extends the
:class:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase` class. This saves a lot of
boilerplate and code duplication by implementing the
:class:`Symfony\\Component\\Form\\Test\\FormIntegrationTestCase` methods for you.
All that's left to do is to implement the
:method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getTemplatePaths`, the
:method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getTwigExtensions` and
the :method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getThemes` methods.

.. versionadded:: 6.4

The :class:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase` class was
introduced in Symfony 6.4.

.. _`PHPUnit data providers`: https://docs.phpunit.de/en/9.6/writing-tests-for-phpunit.html#data-providers