Nikolay Traykov
Nikolay Traykov

Reputation: 1695

PhpStorm doesn't get the folder's configuration when running a single test method

I have a Laravel project with three test directories - Browser, Feature, and Unit.

In Run/Debug configurations I've configured the Feature and the Unit directories to use phpunit.xml while the Browser directory uses phpunit.e2e.xml. I've also created a default configuration for all tests which uses the phpunit.xml.

If I open a class that is in the Feature/Unit directories and run a single test method or the whole class, it picks the default configuration, but when I run a single test method in the Browser directory, it uses phpunit.xml instead of phpunit.e2e.xml.

If I select a directory and run tests, it picks the proper configuration, but when I open a class in the Browser directory, it doesn't

Why doesn't PhpStorm use the configuration of the Browser directory recursively? How can I handle this problem?

Upvotes: 0

Views: 605

Answers (1)

Dirk Scholten
Dirk Scholten

Reputation: 1048

As far as I know PhpStorm has never had this functionality and I wouldn't count on them adding it either. It seems way too specific.

What you can do though, is specify the configuration file you want to use through the commandline.

See: https://phpunit.de/manual/6.5/en/textui.html#textui.clioptions

So your command would look something like this:

phpunit tests\Unit\SomeTest.php --configuration phpunit.xml

or

phpunit tests\Browser\SomeTest.php --configuration phpunit.e2e.xml

Upvotes: 1

Related Questions