Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@ This command will generate a ``PostFactory`` class that looks like this:

Using ``make:factory --test`` will generate the factory in ``tests/Factory``.

.. tip::

When using ``--test`` flag, we're still dealing with ``dev`` environment. And because we want the container to know about our factories,
we need to declare them as services even if they are in the ``tests`` directory. To do that, add the following to your configuration:

.. code-block:: yaml

# config/packages/zenstruck_foundry.yaml
when@dev:
services:
App\Tests\Factory\:
resource: '%kernel.project_dir%/tests/Factory/'
autowire: true
autoconfigure: true

.. tip::

You can globally configure which namespace the factories will be generated in:
Expand Down