Reproducer for Symfony UX TwigComponent test helper not being able to render blocks when using {% with … only %}
composer install
vendor/bin/phpunitThe single test in the project passes.
(It might emit warnings/issues.)
The single test in the project fails with:
1) App\FunctionalTest::loads_component
Twig\Error\RuntimeError: Variable "blocks" does not exist in "__string_template__d4011b95956114f86c150627f8ecfaab" at line 1.
This is because the block is defined with a limited set of variables in its scope. We can't expect production code to specify a variable only introduced (internally) by a test helper.