Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use factory states with Codeception #21

Open
wesol05 opened this issue Dec 19, 2016 · 2 comments
Open

Can't use factory states with Codeception #21

wesol05 opened this issue Dec 19, 2016 · 2 comments
Assignees

Comments

@wesol05
Copy link

wesol05 commented Dec 19, 2016

What are you trying to achieve?

There is no possibility to use factory states: example with $i->have function. I requesting for such functionality

@janhenkgerritsen janhenkgerritsen self-assigned this Dec 20, 2016
@torkiljohnsen
Copy link

👍

@AdrianSkierniewski
Copy link
Contributor

Hi,

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

@Naktibalda Naktibalda transferred this issue from Codeception/Codeception Jan 9, 2021
@TavoNiievez TavoNiievez changed the title [Laravel 5.3] Can't use factory states with codeception Can't use factory states with Codeception Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants