镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Can't use factory states with Codeception #21

Open

Description

@wesol05

What are you trying to achieve?

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

Activity

  1. torkiljohnsen commented on Dec 20, 2016

    @torkiljohnsen

    👍

  2. AdrianSkierniewski commented on May 14, 2018

    @AdrianSkierniewski
    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

  3. changed the title [-][Laravel 5.3] Can't use factory states with codeception[/-] [+]Can't use factory states with Codeception[/+] on Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions