When I run a single test with code coverage, PhpStorm does not load phpunit.xml
I have a project with valid phpunit.xml, that defines code coverage whitelist. When I run the coverage test for the entire project, all is good and coverage is generated and displayed.
But, when I run a single test (Run XYZ with Coverage from context menu), PhpStorm launches a command with --no-configuration switch, so phpunit does not generate coverage. Test gets executed, but I get this:
Error: No whitelist configured, no code coverage will be generated
How can I specify whitelist when running this, or make PhpStorm use my phpunit.xml (second option is preferred)?
Please sign in to leave a comment.
You can edit your Run configuration and force it to use the configuration file:
Yes, noticed that, but how can I tell it that it should do that for every test that I run?
Also, is there a way to treat these runs as "disposable" (not to save them in Run/Debug Configuration)?
Remove all existing Run configurations, open the default one and set the configuration file there, newly created configurations will follow this rule.
Answering the second question, no, there's no such a way.
>Answering the second question, no, there's no such a way.
Well .. try decreasing the number for "Temporary configurations limit" to be just 1 or even 0 (by default it's 5)
This option is available when you focus "Defaults" branch
Thank you, that works.
@Andriy: Great, that's it.
Thank you, Andriy, I wasn't aware.
>You can edit your Run configuration and force it to use the configuration file:
BTW -- you should use this field when you need to specify different config file (e.g. special for this test etc).
Default is set where you configure path to PHPUnit: "Settings/Preferences | Languages & Frameworks | PHP | PHPUnit" -- it's more convenient to manage it here -- you can change it and it will be used by ALL tests that do not have custom config files specified.