class PendingBatchFake extends PendingBatch

Traits

Properties

string $name

The batch name.

from  PendingBatch
array $options

The batch options.

from  PendingBatch
static protected array<class-string, bool> $batchableClasses

Jobs that have been verified to contain the Batchable trait.

from  PendingBatch

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

__construct(BusFake $bus, Collection $jobs)

Create a new pending batch instance.

add(iterable|object $jobs)

Add jobs to the batch.

void
ensureJobIsBatchable(object|array $job)

Ensure the given job is batchable.

before(callable $callback)

Add a callback to be executed when the batch is stored.

array
beforeCallbacks()

Get the "before" callbacks that have been registered with the pending batch.

progress(callable $callback)

Add a callback to be executed after a job in the batch have executed successfully.

array
progressCallbacks()

Get the "progress" callbacks that have been registered with the pending batch.

then(callable $callback)

Add a callback to be executed after all jobs in the batch have executed successfully.

array
thenCallbacks()

Get the "then" callbacks that have been registered with the pending batch.

catch(callable $callback)

Add a callback to be executed after the first failing job in the batch.

array
catchCallbacks()

Get the "catch" callbacks that have been registered with the pending batch.

finally(callable $callback)

Add a callback to be executed after the batch has finished executing.

array
finallyCallbacks()

Get the "finally" callbacks that have been registered with the pending batch.

allowFailures(mixed $param = true)

Indicate that the batch should not be cancelled when a job within the batch fails.

bool
allowsFailures()

Determine if the pending batch allows jobs to fail without cancelling the batch.

array
failureCallbacks()

Get the "failure" callbacks that have been registered with the pending batch.

name(string $name)

Set the name for the batch.

onConnection(UnitEnum|string $connection)

Specify the queue connection that the batched jobs should run on.

string|null
connection()

Get the connection used by the pending batch.

onQueue(UnitEnum|string|null $queue)

Specify the queue that the batched jobs should run on.

string|null
queue()

Get the queue used by the pending batch.

withOption(string $key, mixed $value)

Add additional data into the batch's options array.

dispatch()

Dispatch the batch.

dispatchAfterResponse()

Dispatch the batch after the response is sent to the browser.

void
dispatchExistingBatch(Batch $batch)

Dispatch an existing batch.

Batch|null
dispatchIf(bool|Closure $boolean)

Dispatch the batch if the given truth test passes.

Batch|null
dispatchUnless(bool|Closure $boolean)

Dispatch the batch unless the given truth test passes.

store(BatchRepository $repository)

Store the batch using the given repository.

static void
flushState()

Flush all static state.

string
firstClosureParameterType(Closure $closure)

Get the class name of the first parameter of the given Closure.

array
firstClosureParameterTypes(Closure $closure)

Get the class names of the first parameter of the given Closure, including union types.

array
closureParameterTypes(Closure $closure)

Get the class names / types of the parameters of the given Closure.

array
closureReturnTypes(Closure $closure)

Get the class names / types of the return type of the given Closure.

bool
hasJobs(array $expectedJobs)

Determine if the jobs in the batch match the given jobs.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

at line 22
__construct(BusFake $bus, Collection $jobs)

Create a new pending batch instance.

Parameters

BusFake $bus

the fake bus instance

Collection $jobs

in PendingBatch at line 59
PendingBatch add(iterable|object $jobs)

Add jobs to the batch.

Parameters

iterable|object $jobs

Return Value

PendingBatch

in PendingBatch at line 77
protected void ensureJobIsBatchable(object|array $job)

Ensure the given job is batchable.

Parameters

object|array $job

Return Value

void

Exceptions

RuntimeException

in PendingBatch at line 97
PendingBatch before(callable $callback)

Add a callback to be executed when the batch is stored.

Parameters

callable $callback

Return Value

PendingBatch

in PendingBatch at line 107
array beforeCallbacks()

Get the "before" callbacks that have been registered with the pending batch.

Return Value

array

in PendingBatch at line 115
PendingBatch progress(callable $callback)

Add a callback to be executed after a job in the batch have executed successfully.

Parameters

callable $callback

Return Value

PendingBatch

in PendingBatch at line 125
array progressCallbacks()

Get the "progress" callbacks that have been registered with the pending batch.

Return Value

array

in PendingBatch at line 133
PendingBatch then(callable $callback)

Add a callback to be executed after all jobs in the batch have executed successfully.

Parameters

callable $callback

Return Value

PendingBatch

in PendingBatch at line 143
array thenCallbacks()

Get the "then" callbacks that have been registered with the pending batch.

Return Value

array

in PendingBatch at line 151
PendingBatch catch(callable $callback)

Add a callback to be executed after the first failing job in the batch.

Parameters

callable $callback

Return Value

PendingBatch

in PendingBatch at line 161
array catchCallbacks()

Get the "catch" callbacks that have been registered with the pending batch.

Return Value

array

in PendingBatch at line 169
PendingBatch finally(callable $callback)

Add a callback to be executed after the batch has finished executing.

Parameters

callable $callback

Return Value

PendingBatch

in PendingBatch at line 179
array finallyCallbacks()

Get the "finally" callbacks that have been registered with the pending batch.

Return Value

array

in PendingBatch at line 191
PendingBatch allowFailures(mixed $param = true)

Indicate that the batch should not be cancelled when a job within the batch fails.

Optionally, add callbacks to be executed upon each job failure.

Parameters

mixed $param

Return Value

PendingBatch

in PendingBatch at line 211
bool allowsFailures()

Determine if the pending batch allows jobs to fail without cancelling the batch.

Return Value

bool

in PendingBatch at line 221
array failureCallbacks()

Get the "failure" callbacks that have been registered with the pending batch.

Return Value

array

in PendingBatch at line 239
PendingBatch name(string $name)

Set the name for the batch.

Parameters

string $name

Return Value

PendingBatch

in PendingBatch at line 249
PendingBatch onConnection(UnitEnum|string $connection)

Specify the queue connection that the batched jobs should run on.

Parameters

UnitEnum|string $connection

Return Value

PendingBatch

in PendingBatch at line 261
string|null connection()

Get the connection used by the pending batch.

Return Value

string|null

in PendingBatch at line 269
PendingBatch onQueue(UnitEnum|string|null $queue)

Specify the queue that the batched jobs should run on.

Parameters

UnitEnum|string|null $queue

Return Value

PendingBatch

in PendingBatch at line 281
string|null queue()

Get the queue used by the pending batch.

Return Value

string|null

in PendingBatch at line 289
PendingBatch withOption(string $key, mixed $value)

Add additional data into the batch's options array.

Parameters

string $key
mixed $value

Return Value

PendingBatch

at line 32
Batch dispatch()

Dispatch the batch.

Return Value

Batch

at line 40
Batch dispatchAfterResponse()

Dispatch the batch after the response is sent to the browser.

Return Value

Batch

in PendingBatch at line 345
protected void dispatchExistingBatch(Batch $batch)

Dispatch an existing batch.

Parameters

Batch $batch

Return Value

void

Exceptions

Throwable

in PendingBatch at line 365
Batch|null dispatchIf(bool|Closure $boolean)

Dispatch the batch if the given truth test passes.

Parameters

bool|Closure $boolean

Return Value

Batch|null

in PendingBatch at line 373
Batch|null dispatchUnless(bool|Closure $boolean)

Dispatch the batch unless the given truth test passes.

Parameters

bool|Closure $boolean

Return Value

Batch|null

in PendingBatch at line 381
protected Batch store(BatchRepository $repository)

Store the batch using the given repository.

Parameters

BatchRepository $repository

Return Value

Batch

in PendingBatch at line 401
static void flushState()

Flush all static state.

Return Value

void

in ReflectsClosures at line 25
protected string firstClosureParameterType(Closure $closure)

Get the class name of the first parameter of the given Closure.

Parameters

Closure $closure

Return Value

string

Exceptions

ReflectionException
RuntimeException

in ReflectsClosures at line 48
protected array firstClosureParameterTypes(Closure $closure)

Get the class names of the first parameter of the given Closure, including union types.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException
RuntimeException

in ReflectsClosures at line 74
protected array closureParameterTypes(Closure $closure)

Get the class names / types of the parameters of the given Closure.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException

in ReflectsClosures at line 94
protected array closureReturnTypes(Closure $closure)

Get the class names / types of the return type of the given Closure.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException

at line 48
bool hasJobs(array $expectedJobs)

Determine if the jobs in the batch match the given jobs.

Parameters

array $expectedJobs

Return Value

bool