FakeProcessResult
class FakeProcessResult implements ProcessResult
Properties
| protected string | $output | The process output. |
|
| protected string | $errorOutput | The process error output. |
Methods
Create a new process result instance.
Normalize the given output into a string with newlines.
Get the original command executed by the process.
Create a new fake process result with the given command.
Determine if the process was successful.
Determine if the process failed.
Get the exit code of the process.
Get the standard output of the process.
Determine if the output contains the given string.
Get the error output of the process.
Determine if the error output contains the given string.
Throw an exception if the process failed.
Throw an exception if the process failed and the given condition is true.
Details
at line 31
__construct(string $command = '', int $exitCode = 0, array|string $output = '', array|string $errorOutput = '')
Create a new process result instance.
at line 44
protected string
normalizeOutput(array|string $output)
Normalize the given output into a string with newlines.
at line 63
string
command()
Get the original command executed by the process.
at line 71
FakeProcessResult
withCommand(string $command)
Create a new fake process result with the given command.
at line 79
bool
successful()
Determine if the process was successful.
at line 87
bool
failed()
Determine if the process failed.
at line 95
int|null
exitCode()
Get the exit code of the process.
at line 103
string
output()
Get the standard output of the process.
at line 111
bool
seeInOutput(string $output)
Determine if the output contains the given string.
at line 119
string
errorOutput()
Get the error output of the process.
at line 127
bool
seeInErrorOutput(string $output)
Determine if the error output contains the given string.
at line 137
ProcessResult
throw(callable|null $callback = null)
Throw an exception if the process failed.
at line 157
ProcessResult
throwIf(bool $condition, callable|null $callback = null)
Throw an exception if the process failed and the given condition is true.