You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
66
-
* 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).
66
+
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).
67
67
68
68
In cases you want to use data from database inside your factory definitions you can define them in Helper.
69
69
For instance, if you use Doctrine, this allows you to access `EntityManager` inside a definition.
@@ -147,7 +147,7 @@ $I->have('User', ['is_active' => true]); // creates active user
This does not save it in the database. Use `have` for that.
179
+
180
+
{% highlight php %}
181
+
182
+
$user = $I->make('User'); // return User instance
183
+
$activeUser = $I->make('User', ['is_active' => true]); // return active user instance
184
+
185
+
{% endhighlight %}
186
+
187
+
Returns an instance of created user without creating a record in database.
188
+
189
+
* `param string` $name
190
+
* `param array` $extraAttrs
191
+
192
+
* `return` object
193
+
173
194
<p> </p><divclass="alert alert-warning">Module reference is taken from the source code. <ahref="https://github.com/Codeception/Codeception/tree/2.3/src/Codeception/Module/DataFactory.php">Help us to improve documentation. Edit module reference</a></div>
0 commit comments