class FakeProcessSequence (View source)

Properties

protected array $processes

The fake process results and descriptions.

protected bool $failWhenEmpty

Indicates that invoking this sequence when it is empty should throw an exception.

protected ProcessResult|FakeProcessDescription $emptyProcess

The response that should be returned when the sequence is empty.

Methods

void
__construct(array $processes = [])

Create a new fake process sequence instance.

$this
push(FakeProcessDescription|array|string $process)

Push a new process result or description onto the sequence.

$this
whenEmpty(FakeProcessDescription|array|string $process)

Make the sequence return a default result when it is empty.

toProcessResult(FakeProcessDescription|array|string $process)

Convert the given result into an actual process result or description.

$this
dontFailWhenEmpty()

Make the sequence return a default result when it is empty.

bool
isEmpty()

Indicate that this sequence has depleted all of its process results.

__invoke()

Get the next process in the sequence.

Details

void __construct(array $processes = [])

Create a new fake process sequence instance.

Parameters

array $processes

Return Value

void

$this push(FakeProcessDescription|array|string $process)

Push a new process result or description onto the sequence.

Parameters

FakeProcessDescription|array|string $process

Return Value

$this

$this whenEmpty(FakeProcessDescription|array|string $process)

Make the sequence return a default result when it is empty.

Parameters

FakeProcessDescription|array|string $process

Return Value

$this

protected ProcessResult|FakeProcessDescription toProcessResult(FakeProcessDescription|array|string $process)

Convert the given result into an actual process result or description.

Parameters

FakeProcessDescription|array|string $process

Return Value

ProcessResult|FakeProcessDescription

$this dontFailWhenEmpty()

Make the sequence return a default result when it is empty.

Return Value

$this

bool isEmpty()

Indicate that this sequence has depleted all of its process results.

Return Value

bool

ProcessResult|FakeProcessDescription __invoke()

Get the next process in the sequence.