Excluding Multiple PHPUnit Groups


Committed to the LaraBrain by: wjgilmore (@wjgilmore) at June 24, 2016 2:24 pm

Using groups and a PHPUnit option you can wield total control over which test suites are executed

One of my current projects includes several hundred tests, and some of the test suites are rather time-consuming due to interaction with a third-party test API. I don't always want to run a few of these suites while running the others, and so have assigned groups to the top of each suite, like this:

 * @group stripe
class StripeTest extends TestCase

With the suite group names in place, you can use PHPUnit's --exclude-group option to exclude one or several groups:

$ phpunit --exclude-group stripe,acceptance