From 1688347312b2ae00e8d60df9d31e76170c1756d5 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 4 Oct 2023 13:37:29 +0200 Subject: [PATCH] [TwigBridge] Add `FormLayoutTestCase` class --- form/unit_testing.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 0cff565be00..ddaf5816fcf 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -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