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: 8 additions & 7 deletions src/Codeception/Module/DataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
* }
* ```
*
* Generation rules can be defined in a factories file. You will need to create `factories.php` (it is recommended to store it in `_support` dir)
* Generation rules can be defined in a factories file.
* Create a folder for factories files: `tests/_support/factories`.
*
* Create an ampty PHP file inside that folder `factories.php`.
* Follow [FactoryMuffin documentation](https://github.com/thephpleague/factory-muffin) to set valid rules.
* Random data provided by [Faker](https://github.com/fzaninotto/Faker) library.
* Randomly generated data provided by [Faker](https://github.com/fzaninotto/Faker) library.
*
* Here is the sample factory file:
* ```php
* <?php
* use League\FactoryMuffin\Faker\Facade as Faker;
Expand Down Expand Up @@ -60,12 +64,9 @@
* depends: Yii2
* ```
*
* (you can also use Laravel5 and Phalcon).
*
* In this example factories are loaded from `tests/_support/factories` directory. Please note that this directory is relative from the codeception.yml file (so for Yii2 it would be codeception/_support/factories).
* You should create this directory manually and create PHP files in it with factories definitions following [official documentation](https://github.com/thephpleague/factory-muffin#usage).
* (you can also use Laravel and Phalcon).
*
* In cases you want to use data from database inside your factory definitions you can define them in Helper.
* In cases you want to use data from database inside your factory definitions you can define them in a Helper.
* For instance, if you use Doctrine, this allows you to access `EntityManager` inside a definition.
*
* To proceed you should create Factories helper via `generate:helper` command and enable it:
Expand Down