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)?

0

You can edit your Run configuration and force it to use the configuration file:

 

0
Avatar
Permanently deleted user

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)?

0

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.

0

>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

0
Avatar
Permanently deleted user

Thank you, that works.

0
Avatar
Permanently deleted user

@Andriy: Great, that's it.

0

Thank you, Andriy, I wasn't aware.

0

>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.

0

请先登录再写评论。