8000 minor #18981 Add `FormLayoutTestCase` class (alexandre-daubois) · symfony/symfony-docs@a194b87 · GitHub
[go: up one dir, main page]

Skip to content

Commit a194b87

Browse files
committed
minor #18981 Add FormLayoutTestCase class (alexandre-daubois)
This PR was merged into the 6.4 branch. Discussion ---------- Add `FormLayoutTestCase` class Fix #18961 Commits ------- 1688347 [TwigBridge] Add `FormLayoutTestCase` class
2 parents 1d1ecbe + 1688347 commit a194b87

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

form/unit_testing.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,18 @@ guessers using the :method:`Symfony\\Component\\Form\\Test\\FormIntegrationTestC
240240
and :method:`Symfony\\Component\\Form\\Test\\FormIntegrationTestCase::getTypeGuessers`
241241
methods.
242242

243+
If you want to test the themes of your forms, you may want to make your test extends the
244+
:class:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase` class. This saves a lot of
245+
boilerplate and code duplication by implementing the
246+
:class:`Symfony\\Component\\Form\\Test\\FormIntegrationTestCase` methods for you.
247+
All that's left to do is to implement the
248+
:method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getTemplatePaths`, the
249+
:method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getTwigExtensions` and
250+
the :method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getThemes` methods.
251+
252+
.. versionadded:: 6.4
253+
254+
The :class:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase` class was
255+
introduced in Symfony 6.4.
256+
243257
.. _`PHPUnit data providers`: https://docs.phpunit.de/en/9.6/writing-tests-for-phpunit.html#data-providers

0 commit comments

Comments
 (0)
0