Run a single PHPUnit test


I want to run a single PHPUnit test by adapting the phpunit.xml.dist file, which is included in YIi2. My current PHPUnit XML file looks that way:

It is located in the same folder like the phpunit.xml.dist file, which is shipped with Yii2 and works on my system.

How must be my configuration above modified, so that I can run a single test like f.e. /tests/unit/framework/base/ActiveFilterTest.php?

Currently I’m getting the following error message in my PHPStorm IDE (please note that the phpunit.xml.dist configuration works already):

First off: Rename your [font=“Courier New”]custom_phpunit.xml.dist[/font] to [font=“Courier New”]phpunit.xml[/font]. It’s going to take precedence over [font=“Courier New”]phpunit.xml.dist[/font] and will make your life much easier. Now from the same directory simply call this:

phpunit /tests/unit/framework/base/ActiveFilterTest.php

I’m also puzzled why phpunit doesn’t find your test in the first place. Running PHPUnit with [font=“Courier New”]–verbose[/font] and/or [font=“Courier New”]–debug[/font] may be more revealing on what’s going on here.

Thanks for your reply, but it doesn’t work.

If I follow your steps, the output is the following:

helped. :)