Skip to main content

Running specific PHPUnit data provider data set with PhpStorm

Published on

I'm a huge fan of using data sets for PHPUnit test cases to cover as many permutations as possible with given inputs. The only problem is when you want to execute a specific data set for the test. I'm not much of a PHPUnit command line guru since I run tests individually in PhpStorm. My workflow is generally: run the test method and use re-run failed tests to execute those specific data sets. But! This has changed with recent versions of PhpStorm.

Now there is the ability to run an individual data set for a test. You can now click the gutter icon to run or debug a specific data set for a PHPUnit test like running individual tests.

I don't know what version released this feature. It is not called out in the release notes but I think it may have been with 2022.2 when they released highlighting failed test assertions.

I'm available for one-on-one consulting calls – click here to book a meeting with me 🗓️