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
I'm using factories with Codeception quite some time. I'm just using them in my helpers (example here), but I encountered a problem with some memory leaks from Faker library.
If we want to support factories we'd need to re-bind Faker & EloquentFactory in _after hook, to remove all references to faker between tests, so garbage collector can do his job.
Something like that:
$this->app->singleton(FakerGenerator::class, function ($app) {
return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US'));
});
$this->app->singleton(EloquentFactory::class, function ($app) {
return EloquentFactory::construct(
$app->make(FakerGenerator::class), $this->app->databasePath('factories')
);
});
I know that this isn't perfect but Laravel doesn't have build in method to run it on application. They're doing this here
What are you trying to achieve?
There is no possibility to use factory states: example with $i->have function. I requesting for such functionality
The text was updated successfully, but these errors were encountered: