Skip to content

[5.1] All commands in app\Console\Commands\Kernel are instantiated when running unit tests #13789

@markdwhite

Description

@markdwhite

The particular problem is on a project with about 25 commands with a fair bit of DI in constructors, but I guess it applies to all projects to a degree.

With code-coverage turned on, there seems to be excessive amounts of 'what other classes are being loaded' being done by code-coverage which is killing the performance of phpunit. I usually turn code-coverage off because of the overhead, but when I need it, it's painful to see time taken going up by about 50x.

Is there a need for all commands to be instantiated when $app->environment('testing') as if this didn't happen it would alleviate the problem? Or is it just something to live with? Or am I missing an simple way to mitigate this?

Metadata

Metadata

Assignees

No one assigned

    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