mirror of
https://github.com/pestphp/pest.git
synced 2026-06-15 07:28:23 +02:00
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:
@ -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']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user