File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,6 +181,21 @@ This command will generate a ``PostFactory`` class that looks like this:
181181
182182 Using ``make:factory --test `` will generate the factory in ``tests/Factory ``.
183183
184+ .. tip ::
185+
186+ When using ``--test `` flag, we're still dealing with ``dev `` environment. And because we want the container to know about our factories,
187+ we need to declare them as services even if they are in the ``tests `` directory. To do that, add the following to your configuration:
188+
189+ .. code-block :: yaml
190+
191+ # config/packages/zenstruck_foundry.yaml
192+ when@dev :
193+ services :
194+ App\Tests\Factory\ :
195+ resource : ' %kernel.project_dir%/tests/Factory/'
196+ autowire : true
197+ autoconfigure : true
198+
184199 .. tip ::
185200
186201 You can globally configure which namespace the factories will be generated in:
You can’t perform that action at this time.
0 commit comments