芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/paymoney/vendor/laravel/framework/src/Illuminate/Process/Factory.php
recording = true; if (is_null($callback)) { $this->fakeHandlers = ['*' => fn () => new FakeProcessResult]; return $this; } if ($callback instanceof Closure) { $this->fakeHandlers = ['*' => $callback]; return $this; } foreach ($callback as $command => $handler) { $this->fakeHandlers[is_numeric($command) ? '*' : $command] = $handler instanceof Closure ? $handler : fn () => $handler; } return $this; } /** * Determine if the process factory has fake process handlers and is recording processes. * * @return bool */ public function isRecording() { return $this->recording; } /** * Record the given process if processes should be recorded. * * @param \Illuminate\Process\PendingProcess $process * @param \Illuminate\Contracts\Process\ProcessResult $result * @return $this */ public function recordIfRecording(PendingProcess $process, ProcessResultContract $result) { if ($this->isRecording()) { $this->record($process, $result); } return $this; } /** * Record the given process. * * @param \Illuminate\Process\PendingProcess $process * @param \Illuminate\Contracts\Process\ProcessResult $result * @return $this */ public function record(PendingProcess $process, ProcessResultContract $result) { $this->recorded[] = [$process, $result]; return $this; } /** * Indicate that an exception should be thrown if any process is not faked. * * @param bool $prevent * @return $this */ public function preventStrayProcesses(bool $prevent = true) { $this->preventStrayProcesses = $prevent; return $this; } /** * Determine if stray processes are being prevented. * * @return bool */ public function preventingStrayProcesses() { return $this->preventStrayProcesses; } /** * Assert that a process was recorded matching a given truth test. * * @param \Closure|string $callback * @return $this */ public function assertRan(Closure|string $callback) { $callback = is_string($callback) ? fn ($process) => $process->command === $callback : $callback; PHPUnit::assertTrue( collect($this->recorded)->filter(function ($pair) use ($callback) { return $callback($pair[0], $pair[1]); })->count() > 0, 'An expected process was not invoked.' ); return $this; } /** * Assert that a process was recorded a given number of times matching a given truth test. * * @param \Closure|string $callback * @param int $times * @return $this */ public function assertRanTimes(Closure|string $callback, int $times = 1) { $callback = is_string($callback) ? fn ($process) => $process->command === $callback : $callback; $count = collect($this->recorded)->filter(function ($pair) use ($callback) { return $callback($pair[0], $pair[1]); })->count(); PHPUnit::assertSame( $times, $count, "An expected process ran {$count} times instead of {$times} times." ); } /** * Assert that a process was not recorded matching a given truth test. * * @param \Closure|string $callback * @return $this */ public function assertNotRan(Closure|string $callback) { $callback = is_string($callback) ? fn ($process) => $process->command === $callback : $callback; PHPUnit::assertTrue( collect($this->recorded)->filter(function ($pair) use ($callback) { return $callback($pair[0], $pair[1]); })->count() === 0, 'An unexpected process was invoked.' ); return $this; } /** * Assert that a process was not recorded matching a given truth test. * * @param \Closure|string $callback * @return $this */ public function assertDidntRun(Closure|string $callback) { return $this->assertNotRan($callback); } /** * Assert that no processes were recorded. * * @return $this */ public function assertNothingRan() { PHPUnit::assertEmpty( $this->recorded, 'An unexpected process was invoked.' ); return $this; } /** * Start defining a pool of processes. * * @param callable $callback * @return \Illuminate\Process\Pool */ public function pool(callable $callback) { return new Pool($this, $callback); } /** * Run a pool of processes and wait for them to finish executing. * * @param callable $callback * @param callable|null $output * @return \Illuminate\Process\ProcessPoolResults */ public function concurrently(callable $callback, ?callable $output = null) { return (new Pool($this, $callback))->start($output)->wait(); } /** * Create a new pending process associated with this factory. * * @return \Illuminate\Process\PendingProcess */ public function newPendingProcess() { return (new PendingProcess($this))->withFakeHandlers($this->fakeHandlers); } /** * Dynamically proxy methods to a new pending process instance. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { if (static::hasMacro($method)) { return $this->macroCall($method, $parameters); } return $this->newPendingProcess()->{$method}(...$parameters); } }