mirror of
https://github.com/composer/composer
synced 2025-05-09 08:32:56 +00:00
Stop relying on OS to find executables on Windows, and migrate most Process calls to array syntax (#12180)
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
This commit is contained in:
parent
5a75d32414
commit
3dc279cf66
45 changed files with 714 additions and 584 deletions
|
@ -57,16 +57,16 @@ class ProcessExecutorMock extends ProcessExecutor
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array<string|array{cmd: string|list<string>, return?: int, stdout?: string, stderr?: string, callback?: callable}> $expectations
|
||||
* @param array<string|non-empty-list<string>|array{cmd: string|non-empty-list<string>, return?: int, stdout?: string, stderr?: string, callback?: callable}> $expectations
|
||||
* @param bool $strict set to true if you want to provide *all* expected commands, and not just a subset you are interested in testing
|
||||
* @param array{return: int, stdout?: string, stderr?: string} $defaultHandler default command handler for undefined commands if not in strict mode
|
||||
*/
|
||||
public function expects(array $expectations, bool $strict = false, array $defaultHandler = ['return' => 0, 'stdout' => '', 'stderr' => '']): void
|
||||
{
|
||||
/** @var array{cmd: string|list<string>, return: int, stdout: string, stderr: string, callback: callable|null} $default */
|
||||
/** @var array{cmd: string|non-empty-list<string>, return: int, stdout: string, stderr: string, callback: callable|null} $default */
|
||||
$default = ['cmd' => '', 'return' => 0, 'stdout' => '', 'stderr' => '', 'callback' => null];
|
||||
$this->expectations = array_map(static function ($expect) use ($default): array {
|
||||
if (is_string($expect)) {
|
||||
if (is_string($expect) || array_is_list($expect)) {
|
||||
$command = $expect;
|
||||
$expect = $default;
|
||||
$expect['cmd'] = $command;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue