-
-
Notifications
You must be signed in to change notification settings - Fork 437
fix: --parallel does not handle multiple --exclude-group flags (or any other multiple flags) #1468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.x
Are you sure you want to change the base?
Conversation
Helped figure out what was happening, confirm the problem and workaround. Will be removed in later commit.
Update existing Parallel test with correct expected counts
|
Created PR with failing test before pushing solution commits, hoping tests would run and fail. |
|
Some more info: I created a new laravel project using phpunit to see if that is where the issue lies. It comes with PHPUnit 11. When I run |
|
Because I made a stupid debugging mistake I think I got it working before. This works for me with this PR:
Without this PR it fails. Thanks @flap152 |
|
It won't resolve the failing checks, but I now see a better sequence in using lint/rector/snapshot to make the PR cleaner. I will likely commit tonight. |
Return re-indexed array to avoid problems for callers assuming the array is re-indexed.
|
I returned to using |
|
I haven't added a test for it, but this PR also fixes #1478 |
|
Commenting to follow. Experiencing the same issue. |
|
@nunomaduro I would gladly work on fixing anything wrong in this PR. Eager to learn+help. Thx. |
|
I think this is why I can't get |

What:
Description:
This PR fixes issue 1437 where additional --exlude-group options were ignored when using --parallel flag.
Problem:
In version 3.x and 4.0, running tests with
--parallelusing multiple--exclude-groupoptions, only the first option was used.This probably applies to other multiple-use options such as
--group.This problem is made worse in v4.0 using PHPUnit 12, forcing the use of multiple option vs comma-separated list.
Root Cause:
Some plugin argument handlers remove an argument from the
$argumentsarray byusing array_flip()twice, wrongly assume the remaining array is unchanged, but any non-unique value is removed from the array.This breaks Parallel because long options (
--option=value) in the argument array appear as two items (['--option','value']) causing potential duplicates.The non-parallel worker argument pipeline keeps option and value together in the array (
['--option=value']) avoiding duplicates.Solution:
Modified
popArgument()inHandleArgumentsTrait to useunset()instead of doublearray_flip()Modified
Coverageplugin to use the Trait method instead of its ownarray_flip()code.Testing:
Added test case to verify a second --exclude-group is not ignored in parallel mode
Added test case to popArgument() Trait method
Verified existing functionality still works
Test snapshots may need to be updated.
Related:
Fixes issue 1437