You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a data provider you can easily run the same test for a different set of values. However, this construction currently requires the number of parameters to match the expected number, and them be in the exact same order as expected by the test method.
Since PHP 8.0 it is possible to pass argument by name to a method, which can be combined with array destructuring to allow passing arguments by name to a function. This would allow something like the very simple example below:
Using a data provider you can easily run the same test for a different set of values. However, this construction currently requires the number of parameters to match the expected number, and them be in the exact same order as expected by the test method.
Since PHP 8.0 it is possible to pass argument by name to a method, which can be combined with array destructuring to allow passing arguments by name to a function. This would allow something like the very simple example below:
I got my local testsuite to behave like this by removing the
array_values
call that is applied to the test arguments before running, i.e. changingphpunit/src/Framework/TestCase.php
Line 1016 in a066359
to
but I'm not sure of possible consequences elsewhere, so have not yet found time to make a proper PR yet.
Edit: it seems that the
array_values
call is actually required to makedependencyInput
function properly; if I changephpunit/src/Framework/TestCase.php
Line 1011 in a066359
to
all existing tests seem to pass locally as before.
The text was updated successfully, but these errors were encountered: