Tip #4: Named Parameters
The advantage of YAML files for configuration is supposed to be easy readability. But if a data provider looks like this, there’s not so much readability left:
- - 7 - 1 - 5: 7 6: 9 - - 7 - 1 - 5: 8 6: 10
Technically the same, but way more maintainable:
Bundle_X_A1_B2: product_id: 7 qty: 1 bundle_selections_by_option: 5: 7 6: 9 Bundle_X_A2_B2: product_id: 7 qty: 1 bundle_selections_by_option: 5: 8 6: 10
You can at least guess, that this one is about adding bundle products to the cart, and if you know it, the test data is easy to understand, without having to look at the source code.
Another positive effect is, that for failed tests PHPUnit doesn’t show messages like TestCase::test() with data set #1
anymore, but for example TestCase::test() with data set "Bundle_X_A1_B2"