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 Closure|null $outputHandler

The general output handler callback.

protected bool $outputHandlerFailed

Indicates that the output handler has failed.

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.

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

Stop the process if it is still running.

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.

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
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 100
bool hasReceivedSignal(int $signal)

Determine if the process has received the given signal.

Parameters

int $signal

Return Value

bool

at line 108
bool running()

Determine if the process is still running.

Return Value

bool

at line 132
protected array|false invokeOutputHandlerWithNextLineOfOutput()

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

Return Value

array|false

at line 168
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 184
string output()

Get the standard output for the process.

Return Value

string

at line 202
string errorOutput()

Get the error output for the process.

Return Value

string

at line 220
string latestOutput()

Get the latest standard output for the process.

Return Value

string

at line 241
string latestErrorOutput()

Get the latest error output for the process.

Return Value

string

at line 262
void ensureNotTimedOut()

Ensure that the process has not timed out.

Return Value

void

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

Wait for the process to finish.

Parameters

callable|null $output

Return Value

ProcessResult

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

Wait until the given callback returns true.

Parameters

callable|null $output

Return Value

ProcessResult

at line 316
ProcessResult predictProcessResult()

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

Return Value

ProcessResult

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

Set the general output handler for the fake invoked process.

Parameters

callable|null $outputHandler

Return Value

FakeInvokedProcess