Files
pest/tests/Unit/Plugins/Concerns/PushArgument.php
T
Jhon Farias d2c1b99236 fix: keep the options that Pest adds before -- (#2087)
* fix: keep added options before the `--` separator

Pest added its own options (`--runner`, `--cache-directory`, `--teamcity`, `--no-coverage`, ...) after the `--` that the user gave. PHPUnit and ParaTest then read them as paths, thus `pest -- <path>` and `pest --parallel -- <path>` failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep every option that Pest adds before `--`

pushArgument renumbers the list before it searches `--`, because bin/pest unsets options without array_values. Coverage, Shard and the `--teamcity` handling of bin/pest now place their options before `--` too. The changed files lose their comments, as AGENTS.md section 4 asks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-12-04 14:41:42 +05:30

16 lines
474 B
PHP

<?php
use Pest\Plugins\Concerns\HandleArguments;
test('pushArgument inserts before the option separator when the keys have gaps', function (): void {
$argumentHandler = new class
{
use HandleArguments;
};
$arguments = [0 => 'bin/pest', 2 => '--', 3 => 'tests/Fixtures/ExampleTest.php'];
expect($argumentHandler->pushArgument('--no-output', $arguments))
->toBe(['bin/pest', '--no-output', '--', 'tests/Fixtures/ExampleTest.php']);
});