final class ProcessResult

internal  
 

Process result with additional passthrough methods for testbench.

Traits

Properties

protected array<int, string> $passthru

The methods that should be forwarded to the process instance.

Methods

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

__construct(Process $process, Closure|array|string $command)

Create a new process result instance.

string
command()

Get the original command executed by the process.

bool
successful()

Determine if the process was successful.

bool
failed()

Determine if the process failed.

int|null
exitCode()

Get the exit code of the process.

mixed
output()

Get the standard output of the process.

bool
seeInOutput(string $output)

Determine if the output contains the given string.

string
errorOutput()

Get the error output of the process.

bool
seeInErrorOutput(string $output)

Determine if the error output contains the given string.

throw(callable|null $callback = null)

Throw an exception if the process failed.

throwIf(bool $condition, callable|null $callback = null)

Throw an exception if the process failed and the given condition is true.

mixed
__call(string $method, array $parameters)

Handle dynamic calls to the process instance.

Details

in ForwardsCalls at line 22
protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 52
protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 66
static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

at line 44
__construct(Process $process, Closure|array|string $command)

Create a new process result instance.

Parameters

Process $process

The underlying Symfony process

Closure|array|string $command

The original command

at line 53
string command()

Get the original command executed by the process.

Return Value

string

at line 61
bool successful()

Determine if the process was successful.

Return Value

bool

at line 69
bool failed()

Determine if the process failed.

Return Value

bool

at line 77
int|null exitCode()

Get the exit code of the process.

Return Value

int|null

at line 87
mixed output()

Get the standard output of the process.

Return Value

mixed

Exceptions

Throwable

at line 161
bool seeInOutput(string $output)

Determine if the output contains the given string.

Parameters

string $output

Return Value

bool

at line 169
string errorOutput()

Get the error output of the process.

Return Value

string

at line 177
bool seeInErrorOutput(string $output)

Determine if the error output contains the given string.

Parameters

string $output

Return Value

bool

at line 185
ProcessResult throw(callable|null $callback = null)

Throw an exception if the process failed.

Parameters

callable|null $callback

Return Value

ProcessResult

at line 203
ProcessResult throwIf(bool $condition, callable|null $callback = null)

Throw an exception if the process failed and the given condition is true.

Parameters

bool $condition
callable|null $callback

Return Value

ProcessResult

at line 217
mixed __call(string $method, array $parameters)

Handle dynamic calls to the process instance.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException