Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run one specific data from a data provider in phpunit

Tags:

phpunit

If I want to run a test with just one data from the data provider how would I do it?

I tried the solution on this thread and did not work Cannot run single test with data provider in PHPUnit

like image 268
Deepa Padmanabhan Avatar asked Nov 18 '15 23:11

Deepa Padmanabhan


1 Answers

I found out that just adding #n would just work for numerically indexed data providers.

phpunit --filter ClassName::testName#datasetNumber

Add @name for associatively indexed named data providers.

phpunit --filter ClassName::testName@datasetName

Or you can use regular expressions. See the documentation for more examples.

like image 78
Deepa Padmanabhan Avatar answered Sep 22 '22 06:09

Deepa Padmanabhan