class FakeInvokedProcess implements InvokedProcess (View source)

Properties

protected string $command

The command being faked.

protected FakeProcessDescription $process

The underlying process description.

protected array $receivedSignals

The signals that have been received.

protected int|null $remainingRunIterations

The number of times the process should indicate that it is "running".

protected callable|null $outputHandler

The general output handler callback.

protected int $nextOutputIndex

The current output's index.

protected int $nextErrorOutputIndex

The current error output's index.

Methods

void
__construct(string $command, FakeProcessDescription $process)

Create a new invoked process instance.

int|null
id()

Get the process ID if the process is still running.

$this
signal(int $signal)

Send a signal to the process.

bool
hasReceivedSignal(int $signal)

Determine if the process has received the given signal.

bool
running()

Determine if the process is still running.

array|false
invokeOutputHandlerWithNextLineOfOutput()

Invoke the asynchronous output handler with the next single line of output if necessary.

string
output()

Get the standard output for the process.

string
errorOutput()

Get the error output for the process.

string
latestOutput()

Get the latest standard output for the process.

string
latestErrorOutput()

Get the latest error output for the process.

ProcessResult
wait(callable $output = null)

Wait for the process to finish.

predictProcessResult()

Get the ultimate process result that will be returned by this "process".

$this
withOutputHandler(callable|null $outputHandler)

Set the general output handler for the fake invoked process.

Details

void __construct(string $command, FakeProcessDescription $process)

Create a new invoked process instance.

Parameters

string $command
FakeProcessDescription $process

Return Value

void

int|null id()

Get the process ID if the process is still running.

Return Value

int|null

$this signal(int $signal)

Send a signal to the process.

Parameters

int $signal

Return Value

$this

bool hasReceivedSignal(int $signal)

Determine if the process has received the given signal.

Parameters

int $signal

Return Value

bool

bool running()

Determine if the process is still running.

Return Value

bool

protected array|false invokeOutputHandlerWithNextLineOfOutput()

Invoke the asynchronous output handler with the next single line of output if necessary.

Return Value

array|false

string output()

Get the standard output for the process.

Return Value

string

string errorOutput()

Get the error output for the process.

Return Value

string

string latestOutput()

Get the latest standard output for the process.

Return Value

string

string latestErrorOutput()

Get the latest error output for the process.

Return Value

string

ProcessResult wait(callable $output = null)

Wait for the process to finish.

Parameters

callable $output

Return Value

ProcessResult

ProcessResult predictProcessResult()

Get the ultimate process result that will be returned by this "process".

Return Value

ProcessResult

$this withOutputHandler(callable|null $outputHandler)

Set the general output handler for the fake invoked process.

Parameters

callable|null $outputHandler

Return Value

$this