class FakeInvokedProcess implements InvokedProcess

Properties

protected array<int, int> $receivedSignals

The signals that have been received.

protected int|null $remainingRunIterations

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

protected bool $stopped

Indicates whether the process has been stopped.

protected Closure|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

__construct(string $command, FakeProcessDescription $process)

Create a new invoked process instance.

int|null
id()

Get the process ID if the process is still running.

string
command()

Get the command line for the process.

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.

void
callOutputHandler(Closure $outputHandler, string $type, string $buffer)

Invoke the output handler for the given output.

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.

void
ensureNotTimedOut()

Ensure that the process has not timed out.

wait(callable|null $output = null)

Wait for the process to finish.

waitUntil(callable|null $output = null)

Wait until the given callback returns true.

int|null
stop(float $timeout = 10, int|null $signal = null)

Stop the process if it is still running.

predictProcessResult()

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

withOutputHandler(callable|null $outputHandler)

Set the general output handler for the fake invoked process.

Details

at line 49
__construct(string $command, FakeProcessDescription $process)

Create a new invoked process instance.

Parameters

string $command
FakeProcessDescription $process

at line 58
int|null id()

Get the process ID if the process is still running.

Return Value

int|null

at line 70
string command()

Get the command line for the process.

Return Value

string

at line 78
InvokedProcess signal(int $signal)

Send a signal to the process.

Parameters

int $signal

Return Value

InvokedProcess

at line 90
bool hasReceivedSignal(int $signal)

Determine if the process has received the given signal.

Parameters

int $signal

Return Value

bool

at line 98
bool running()

Determine if the process is still running.

Return Value

bool

at line 126
protected array|false invokeOutputHandlerWithNextLineOfOutput()

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

Return Value

array|false

at line 162
protected void callOutputHandler(Closure $outputHandler, string $type, string $buffer)

Invoke the output handler for the given output.

Parameters

Closure $outputHandler
string $type
string $buffer

Return Value

void

at line 177
string output()

Get the standard output for the process.

Return Value

string

at line 195
string errorOutput()

Get the error output for the process.

Return Value

string

at line 213
string latestOutput()

Get the latest standard output for the process.

Return Value

string

at line 234
string latestErrorOutput()

Get the latest error output for the process.

Return Value

string

at line 255
void ensureNotTimedOut()

Ensure that the process has not timed out.

Return Value

void

at line 262
ProcessResult wait(callable|null $output = null)

Wait for the process to finish.

Parameters

callable|null $output

Return Value

ProcessResult

at line 284
ProcessResult waitUntil(callable|null $output = null)

Wait until the given callback returns true.

Parameters

callable|null $output

Return Value

ProcessResult

at line 309
int|null stop(float $timeout = 10, int|null $signal = null)

Stop the process if it is still running.

Parameters

float $timeout
int|null $signal

Return Value

int|null

at line 320
ProcessResult predictProcessResult()

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

Return Value

ProcessResult

at line 328
FakeInvokedProcess withOutputHandler(callable|null $outputHandler)

Set the general output handler for the fake invoked process.

Parameters

callable|null $outputHandler

Return Value

FakeInvokedProcess