File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -181,21 +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- If your entity has some properties with Doctrine relationships, the factories for the related entities must be registered
185- in the service container so that the maker command can find them. To do that, add the following to your ``services.yaml ``.
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:
186188
187189 .. code-block :: yaml
188190
189- # config/packages/services .yaml
191+ # config/packages/zenstruck_foundry .yaml
190192 when@dev :
191193 services :
192- _defaults :
194+ App\Tests\Factory\ :
195+ resource : ' ../../tests/Factory/'
193196 autowire : true
194197 autoconfigure : true
195198
196- App\Tests\Factory\ :
197- resource : ' ../tests/Factory/'
198-
199199 .. tip ::
200200
201201 You can globally configure which namespace the factories will be generated in:
You can’t perform that action at this time.
0 commit comments