Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter for multiple tests in PHPUnit?

Tags:

php

phpunit

I am able to run a single test from a suite using --filter option.

I am wondering if there is a way to dynamically run multiple tests under the suite?

Thanks

like image 663
oyeesh Avatar asked Jul 11 '26 17:07

oyeesh


1 Answers

A simple regex to filter for multiple tests could look like --filter '/test1|test2|test4/'. This will match any tests which contain 'test1' 'test2' or 'test4' so for example test43 would be included, but test3 would not get run. The check is case-sensitive.

like image 160
Jonathan1055 Avatar answered Jul 13 '26 12:07

Jonathan1055



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!