fix: popArgument drops duplicate arguments breaking --parallel --exclude-gropup= (#1674)

* fix: popArgument drops duplicate arguments breaking --parallel multi-exclude-group

Fixes #1437

* fix: ensure popArgument handles duplicate arguments

* fix: update expected test results and snapshots after rebase

---------

Signed-off-by: nuno maduro <enunomaduro@gmail.com>
Co-authored-by: nuno maduro <enunomaduro@gmail.com>
This commit is contained in:
flap152
2026-06-12 12:58:37 -04:00
committed by GitHub
parent 97714a7088
commit 8467c64c22
5 changed files with 49 additions and 8 deletions

View File

@ -24,3 +24,27 @@ test('method hasArgument', function (string $argument, bool $expectedResult) {
['--a', false],
['--undefined-argument', false],
]);
test('popArgument preserves duplicate values when removing a missing argument', function () {
$obj = new class
{
use HandleArguments;
};
$arguments = ['--verbose', '--exclude-group', 'firstGroup', '--exclude-group', 'secondGroup', '--filter=MyTest'];
$result = $obj->popArgument('--missingitem', $arguments);
expect($result)->toBe($arguments);
});
test('popArgument preserves duplicate values when removing an existing argument', function () {
$obj = new class
{
use HandleArguments;
};
$arguments = ['--verbose', '--exclude-group', 'firstGroup', '--exclude-group', 'secondGroup', '--filter=MyTest'];
$result = $obj->popArgument('--verbose', $arguments);
expect($result)->toBe(['--exclude-group', 'firstGroup', '--exclude-group', 'secondGroup', '--filter=MyTest']);
});