PHPUnit needs to be configured for every single test or class

Hello,

I have successfully configured PHPStorm and PHPUnit to run all tests at once in my project.
All tests complete without any error.

However, when I try to run a single class or test in a file, I get the message:
"Could not read "{projectPath}/api/phpunit.xml" (I masked the real path)

This path is correct, and yet it cannot be opened.
I then need to click "Modify Run Configuration" and tick the following checkboxes for that class:
- "Use alternative configuration file"
- "Use alternative bootstrap file"

The first path to phpunit.xml is the same as above. So I don't have to do anything else there.
However, the path to the bootstrap.php file is not filled in, even though I had already set it in my general settings.
So I have to select it again.

I have to select this option for each class or for each individual test in a file.
Is there any way to use my general configuration by default, so I don't have to configure this for each individual test?

Thanks in advance!

Best regards
Nick

0
2 comments

Hi there,

Is there any way to use my general configuration by default, so I don't have to configure this for each individual test?

Sure. Just edit the default template.

NOTE that this does not affect existing configurations in any way. These settings will be applied to the freshly created ones only.

 

0

Thank you so much, that seems to work!

0

Please sign in to leave a comment.