When writing tests I try to describe the test in the function name. I use the format
testDoesSomethingWhenPassedSomething to first describe the assertion and then the context.
When I have many data sets running against the same test I will use the frameworks data providers to
make the code less verbose.
The problem with this approach is I have now lost the context from my function name and have reduced
the readability of my tests. If one of these data sets fails PHPUnit will output the following message.
The #2 in the error message refers to the numeric index of the array returned from data provider
which the test failed on. I have discovered that I can improve the readability of the data provider
function and its error messages by creating associative arrays instead of numeric ones.
Now when an error occurs we have regained the context of the test back in the error messages.