Factory
class Factory (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected bool | $recording | Indicates if the process factory has faked process handlers. |
|
protected array | $recorded | All of the recorded processes. |
|
protected array | $fakeHandlers | The registered fake handler callbacks. |
|
protected bool | $preventStrayProcesses | Indicates that an exception should be thrown if any process is not faked. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically proxy methods to a new pending process instance.
Create a new fake process response for testing purposes.
Begin describing a fake process lifecycle.
Begin describing a fake process sequence.
Indicate that the process factory should fake processes.
Determine if the process factory has fake process handlers and is recording processes.
Record the given process if processes should be recorded.
Indicate that an exception should be thrown if any process is not faked.
Determine if stray processes are being prevented.
Assert that a process was recorded matching a given truth test.
Assert that a process was recorded a given number of times matching a given truth test.
Assert that a process was not recorded matching a given truth test.
Assert that a process was not recorded matching a given truth test.
Assert that no processes were recorded.
Start defining a series of piped processes.
Run a pool of processes and wait for them to finish executing.
Create a new pending process associated with this factory.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static void
flushMacros()
Flush the existing macros.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically proxy methods to a new pending process instance.
FakeProcessResult
result(array|string $output = '', array|string $errorOutput = '', int $exitCode = 0)
Create a new fake process response for testing purposes.
FakeProcessDescription
describe()
Begin describing a fake process lifecycle.
FakeProcessSequence
sequence(array $processes = [])
Begin describing a fake process sequence.
$this
fake(Closure|array $callback = null)
Indicate that the process factory should fake processes.
bool
isRecording()
Determine if the process factory has fake process handlers and is recording processes.
$this
recordIfRecording(PendingProcess $process, ProcessResult $result)
Record the given process if processes should be recorded.
$this
record(PendingProcess $process, ProcessResult $result)
Record the given process.
$this
preventStrayProcesses(bool $prevent = true)
Indicate that an exception should be thrown if any process is not faked.
bool
preventingStrayProcesses()
Determine if stray processes are being prevented.
$this
assertRan(Closure|string $callback)
Assert that a process was recorded matching a given truth test.
$this
assertRanTimes(Closure|string $callback, int $times = 1)
Assert that a process was recorded a given number of times matching a given truth test.
$this
assertNotRan(Closure|string $callback)
Assert that a process was not recorded matching a given truth test.
$this
assertDidntRun(Closure|string $callback)
Assert that a process was not recorded matching a given truth test.
$this
assertNothingRan()
Assert that no processes were recorded.
Pool
pool(callable $callback)
Start defining a pool of processes.
ProcessResult
pipe(callable|array $callback, callable|null $output = null)
Start defining a series of piped processes.
ProcessPoolResults
concurrently(callable $callback, callable|null $output = null)
Run a pool of processes and wait for them to finish executing.
PendingProcess
newPendingProcess()
Create a new pending process associated with this factory.