class QueueFake extends QueueManager implements Fake, Queue

Traits

Hosts must declare a protected array $poolableDrivers containing their default poolable drivers.

Properties

protected Closure> $releaseCallbacks from  HasPoolProxy
protected array $connections

The array of resolved queue connections.

from  QueueManager
protected array $connectors

The array of resolved queue connectors.

from  QueueManager
protected array $poolableDrivers

The array of drivers which will be wrapped as pool proxies.

from  QueueManager
protected QueuePoolProxy>> $poolProxyClasses

The pool proxy classes for drivers with supplemental queue capabilities.

from  QueueManager
Factory|null $queue

The original queue manager.

protected Collection $jobsToFake

The job types that should be intercepted instead of pushed to the queue.

protected Collection $jobsToBeQueued

The job types that should be pushed to the queue and not intercepted.

protected array $jobs

All of the jobs that have been pushed.

protected RawPushType> $rawPushes

All of the payloads that have been raw pushed.

protected array $uniqueJobs

All of the unique jobs that were pushed.

protected array $reserved

All of the jobs that have been marked as reserved.

protected bool $serializeAndRestore

Indicates if items should be serialized and restored when pushed to the queue.

protected array<int, callable> $beforePushingCallbacks

The callbacks that should be invoked before pushing a job.

protected array<int, callable> $afterPushingCallbacks

The callbacks that should be invoked after pushing a job.

Methods

mixed
createPoolProxy(string $driver, Closure $createCallback, PoolDefinition $definition, string $proxyClass)

Create a pool proxy for an immutable definition.

poolDefinition(string $resource, array $poolConfig, array $fingerprintSource)

Build a namespaced pool definition for a pooled resource.

poolFactory()

Get the pool factory used by this manager.

setReleaseCallback(string $driver, Closure $callback)

Set the release callback for a pooled driver.

Closure|null
getReleaseCallback(string $driver)

Get the release callback for a pooled driver.

addPoolableDriver(string $driver)

Add a driver to the poolable-driver list.

removePoolableDriver(string $driver)

Remove a driver from the poolable-driver list.

array
getPoolableDrivers()

Get the poolable-driver list.

setPoolableDrivers(array $poolableDrivers)

Set the poolable-driver list.

string|null
resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)

Resolve the default connection name for a given queueable instance.

string|null
resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

queueRoutes()

Get the queue routes manager instance.

queueRoutesContainer()

Get the container that owns the queue routes.

__construct(Container $app, array|string $jobsToFake = [], Factory|null $queue = null)

Create a new fake queue instance.

void
before(mixed $callback)

Register an event listener for the before job event.

void
after(mixed $callback)

Register an event listener for the after job event.

void
exceptionOccurred(mixed $callback)

Register an event listener for the exception occurred job event.

void
looping(mixed $callback)

Register an event listener for the daemon queue loop.

void
failing(mixed $callback)

Register an event listener for the failed job event.

void
starting(mixed $callback)

Register an event listener for the daemon queue starting.

void
stopping(mixed $callback)

Register an event listener for the daemon queue stopping.

void
route(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Register the default queue route for a given class.

void
forward(array|string|UnitEnum $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)

Forward the given queue to another queue and/or connection.

void
pause(UnitEnum|string $queue, UnitEnum|string|null $connection = null)

Pause a queue by its name and connection.

void
pauseFor(UnitEnum|string $queue, DateInterval|DateTimeInterface|int $ttl, UnitEnum|string|null $connection = null)

Pause a queue by its name and connection for a given amount of time.

void
pauseAll()

Pause job processing for all queues on all connections.

void
resume(UnitEnum|string $queue, UnitEnum|string|null $connection = null)

Resume a paused queue by its name and connection.

void
resumeAll()

Resume job processing for all queues on all connections.

bool
isPaused(string $queue, string|null $connection = null)

Determine if a queue is paused.

array
getPausedQueues(array $queues, string|null $connection = null)

Determine which of the given queues are currently paused.

void
withoutInterruptionPolling()

Indicate that queue workers should not poll for restart or pause signals.

bool
connected(UnitEnum|string|null $name = null)

Determine if the driver is connected.

connection(mixed $value = null)

Resolve a queue connection instance.

resolve(string $name)

Resolve a queue connection.

getConnector(string $driver)

Get the connector for a given driver.

void
extend(string $driver, Closure $resolver)

Add a queue connection resolver.

void
addConnector(string $driver, Closure $resolver)

Add a queue connection resolver.

array|null
getConfig(string $name)

Get the queue connection configuration.

string
getDefaultDriver()

Get the name of the default queue connection.

void
setDefaultDriver(UnitEnum|string $name)

Set the name of the default queue connection.

string
getName(string|null $connection = null)

Get the full name for the given connection.

void
purge(string|null $name = null)

Disconnect a queue connection and close its shared resource pool.

getApplication()

Get the application instance used by the manager.

setApplication(Container $app)

Set the application instance used by the manager.

void
createPayloadUsing(callable|null $callback)

Register a callback to be executed when creating job payloads.

mixed
__call(string $method, array $parameters)

Override the QueueManager to prevent circular dependency.

mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

mixed
extractAttributeValue(object $instance)

Extract the value from an attribute instance.

object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

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.

except(array|string $jobsToBeQueued)

Specify the jobs that should be queued instead of faked.

void
assertPushed(Closure|string $job, callable|int|null $callback = null)

Assert if a job was pushed based on a truth-test callback.

void
assertPushedTimes(string $job, int $times = 1)

Assert if a job was pushed a number of times.

void
assertPushedOnce(string $job)

Assert if a job was pushed exactly once.

void
assertPushedOn(UnitEnum|string|null $queue, Closure|string $job, callable|null $callback = null)

Assert if a job was pushed based on a truth-test callback.

void
assertPushedWithChain(string $job, array $expectedChain = [], callable|null $callback = null)

Assert if a job was pushed with chained jobs based on a truth-test callback.

void
assertPushedWithoutChain(string $job, callable|null $callback = null)

Assert if a job was pushed with an empty chain based on a truth-test callback.

void
assertPushedWithChainOfObjects(string $job, array $expectedChain, callable|null $callback)

Assert if a job was pushed with chained jobs based on a truth-test callback.

void
assertPushedWithChainOfClasses(string $job, array $expectedChain, callable|null $callback)

Assert if a job was pushed with chained jobs based on a truth-test callback.

void
assertClosurePushed(callable|int|null $callback = null)

Assert if a closure was pushed based on a truth-test callback.

void
assertClosureNotPushed(callable|null $callback = null)

Assert that a closure was not pushed based on a truth-test callback.

bool
isChainOfObjects(array $chain)

Determine if the given chain is entirely composed of objects.

void
assertNotPushed(Closure|string $job, callable|null $callback = null)

Determine if a job was pushed based on a truth-test callback.

void
assertCount(int $expectedCount)

Assert the total count of jobs that were pushed.

void
assertNothingPushed()

Assert that no jobs were pushed.

pushed(string $job, callable|null $callback = null)

Get all of the jobs matching a truth-test callback.

pushedRaw(Closure|null $callback = null)

Get all of the raw pushes matching a truth-test callback.

listenersPushed(string $listenerClass, callable|null $callback = null)

Get all of the jobs by listener class, passing an optional truth-test callback.

bool
hasPushed(string $job)

Determine if there are any stored jobs for a given class.

int
size(UnitEnum|string|null $queue = null)

Get the size of the queue.

int
pendingSize(UnitEnum|string|null $queue = null)

Get the number of pending jobs.

int
delayedSize(UnitEnum|string|null $queue = null)

Get the number of delayed jobs.

int
reservedSize(UnitEnum|string|null $queue = null)

Get the number of reserved jobs.

int
totalSize()

Get the number of jobs across every queue.

int
totalPendingSize()

Get the number of pending jobs across every queue.

int
totalDelayedSize()

Get the number of delayed jobs across every queue.

int
totalReservedSize()

Get the number of reserved jobs across every queue.

pendingJobs(UnitEnum|string|null $queue = null)

Get the pending jobs for the given queue.

delayedJobs(UnitEnum|string|null $queue = null)

Get the delayed jobs for the given queue.

reservedJobs(UnitEnum|string|null $queue = null)

Get the reserved jobs for the given queue.

allPendingJobs()

Get all pending jobs across every queue.

allDelayedJobs()

Get all delayed jobs across every queue.

inspectJobs(array $jobs)

Map an array of jobs to a collection of inspected jobs.

allReservedJobs()

Get all reserved jobs across every queue.

array
pushedJobsWithDelay(bool $delayed)

Get pushed jobs classified by their delay.

int|null
creationTimeOfOldestPendingJob(UnitEnum|string|null $queue = null)

Get the creation timestamp of the oldest pending job, excluding delayed jobs.

mixed
push(object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue.

mixed
enqueueUsing(object|string $job, mixed $data, UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int|null $delay)

Push a job through the fake or its underlying queue.

bool
shouldFakeJob(object|string $job)

Determine if a job should be faked or actually dispatched.

bool
shouldDispatchJob(object|string $job)

Determine if a job should be pushed to the queue instead of faked.

mixed
pushRaw(string $payload, UnitEnum|string|null $queue = null, array $options = [])

Push a raw payload onto the queue.

mixed
later(DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue after (n) seconds.

mixed
pushOn(UnitEnum|string|null $queue, object|string $job, mixed $data = '')

Push a new job onto the queue.

mixed
laterOn(UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '')

Push a new job onto a specific queue after (n) seconds.

void
reserve(object|string $job, UnitEnum|string|null $queue = null)

Record the given job as reserved.

Job|null
pop(UnitEnum|string|null $queue = null)

Pop the next job off of the queue.

mixed
bulk(array $jobs, mixed $data = '', UnitEnum|string|null $queue = null)

Push an array of jobs onto the queue.

array
pushedJobs()

Get the jobs that have been pushed.

array
rawPushes()

Get the payloads that were pushed raw.

serializeAndRestore(bool $serializeAndRestore = true)

Specify if jobs should be serialized and restored when being "pushed" to the queue.

mixed
serializeAndRestoreJob(mixed $job)

Serialize and unserialize the job to simulate the queueing process.

void
releaseUniqueJobLocks()

Release the locks for all unique jobs that were pushed.

void
clearReserved()

Clear all of the reserved jobs.

beforePushing(callable $callback)

Register a callback to be invoked before pushing a job.

afterPushing(callable $callback)

Register a callback to be invoked after pushing a job.

string|null
normalizeQueue(UnitEnum|string|null $queue)

Normalize a queue identifier.

string
getConnectionName()

Get the connection name for the queue.

setConnectionName(string $name)

Set the connection name for the queue.

Details

in HasPoolProxy at line 27
protected mixed createPoolProxy(string $driver, Closure $createCallback, PoolDefinition $definition, string $proxyClass)

Create a pool proxy for an immutable definition.

Parameters

string $driver
Closure $createCallback
PoolDefinition $definition
string $proxyClass

Return Value

mixed

in HasPoolProxy at line 48
protected PoolDefinition poolDefinition(string $resource, array $poolConfig, array $fingerprintSource)

Build a namespaced pool definition for a pooled resource.

Parameters

string $resource
array $poolConfig
array $fingerprintSource

Return Value

PoolDefinition

in HasPoolProxy at line 66
abstract protected Factory poolFactory()

Get the pool factory used by this manager.

Return Value

Factory

in HasPoolProxy at line 74
HasPoolProxy setReleaseCallback(string $driver, Closure $callback)

Set the release callback for a pooled driver.

Boot-only. The callback persists on the manager for the worker lifetime and is captured by every subsequently created proxy for the driver.

Parameters

string $driver
Closure $callback

Return Value

HasPoolProxy

in HasPoolProxy at line 84
Closure|null getReleaseCallback(string $driver)

Get the release callback for a pooled driver.

Parameters

string $driver

Return Value

Closure|null

in HasPoolProxy at line 96
HasPoolProxy addPoolableDriver(string $driver)

Add a driver to the poolable-driver list.

Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.

Parameters

string $driver

Return Value

HasPoolProxy

in HasPoolProxy at line 112
HasPoolProxy removePoolableDriver(string $driver)

Remove a driver from the poolable-driver list.

Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.

Parameters

string $driver

Return Value

HasPoolProxy

in HasPoolProxy at line 129
array getPoolableDrivers()

Get the poolable-driver list.

Return Value

array

in HasPoolProxy at line 141
HasPoolProxy setPoolableDrivers(array $poolableDrivers)

Set the poolable-driver list.

Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.

Parameters

array $poolableDrivers

Return Value

HasPoolProxy

string|null resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)

Resolve the default connection name for a given queueable instance.

Parameters

object $queueable
UnitEnum|string|null $queue

the caller-selected queue, overriding the queueable's queue when resolving a forwarded connection

Return Value

string|null

string|null resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

Parameters

object $queueable

Return Value

string|null

protected QueueRoutes queueRoutes()

Get the queue routes manager instance.

Return Value

QueueRoutes

protected Container queueRoutesContainer()

Get the container that owns the queue routes.

Return Value

Container

at line 101
__construct(Container $app, array|string $jobsToFake = [], Factory|null $queue = null)

Create a new fake queue instance.

Parameters

Container $app
array|string $jobsToFake
Factory|null $queue

in QueueManager at line 88
void before(mixed $callback)

Register an event listener for the before job event.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 100
void after(mixed $callback)

Register an event listener for the after job event.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 112
void exceptionOccurred(mixed $callback)

Register an event listener for the exception occurred job event.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 124
void looping(mixed $callback)

Register an event listener for the daemon queue loop.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 136
void failing(mixed $callback)

Register an event listener for the failed job event.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 148
void starting(mixed $callback)

Register an event listener for the daemon queue starting.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 160
void stopping(mixed $callback)

Register an event listener for the daemon queue stopping.

Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent matching queue event.

Parameters

mixed $callback

Return Value

void

in QueueManager at line 174
void route(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Register the default queue route for a given class.

Boot-only. The route persists on the singleton QueueRoutes registry for the worker lifetime and affects every subsequent dispatch of that class.

Parameters

array|string $class
UnitEnum|string|null $queue
UnitEnum|string|null $connection

Return Value

void

in QueueManager at line 187
void forward(array|string|UnitEnum $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)

Forward the given queue to another queue and/or connection.

Boot-only. Forwards persist on the singleton QueueRoutes registry for the worker lifetime and affect every subsequent dispatch and queue operation.

Parameters

array|string|UnitEnum $queue
UnitEnum|string|null $to
UnitEnum|string|null $connection

Return Value

void

in QueueManager at line 203
void pause(UnitEnum|string $queue, UnitEnum|string|null $connection = null)

Pause a queue by its name and connection.

Parameters

UnitEnum|string $queue
UnitEnum|string|null $connection

Return Value

void

in QueueManager at line 225
void pauseFor(UnitEnum|string $queue, DateInterval|DateTimeInterface|int $ttl, UnitEnum|string|null $connection = null)

Pause a queue by its name and connection for a given amount of time.

Parameters

UnitEnum|string $queue
DateInterval|DateTimeInterface|int $ttl
UnitEnum|string|null $connection

Return Value

void

in QueueManager at line 247
void pauseAll()

Pause job processing for all queues on all connections.

Return Value

void

in QueueManager at line 265
void resume(UnitEnum|string $queue, UnitEnum|string|null $connection = null)

Resume a paused queue by its name and connection.

Parameters

UnitEnum|string $queue
UnitEnum|string|null $connection

Return Value

void

in QueueManager at line 289
void resumeAll()

Resume job processing for all queues on all connections.

Queues paused individually are not affected.

Return Value

void

in QueueManager at line 307
bool isPaused(string $queue, string|null $connection = null)

Determine if a queue is paused.

Parameters

string $queue
string|null $connection

Return Value

bool

in QueueManager at line 321
array getPausedQueues(array $queues, string|null $connection = null)

Determine which of the given queues are currently paused.

Parameters

array $queues
string|null $connection

Return Value

array

in QueueManager at line 351
void withoutInterruptionPolling()

Indicate that queue workers should not poll for restart or pause signals.

Boot-only. Mutates process-global worker flags; runtime use races across coroutines and changes every concurrent worker pause or restart check.

Return Value

void

in QueueManager at line 360
bool connected(UnitEnum|string|null $name = null)

Determine if the driver is connected.

Parameters

UnitEnum|string|null $name

Return Value

bool

at line 379
Queue connection(mixed $value = null)

Resolve a queue connection instance.

Parameters

mixed $value

Return Value

Queue

in QueueManager at line 401
protected Queue resolve(string $name)

Resolve a queue connection.

Parameters

string $name

Return Value

Queue

Exceptions

InvalidArgumentException

in QueueManager at line 435
protected ConnectorInterface getConnector(string $driver)

Get the connector for a given driver.

Parameters

string $driver

Return Value

ConnectorInterface

Exceptions

InvalidArgumentException

in QueueManager at line 450
void extend(string $driver, Closure $resolver)

Add a queue connection resolver.

Boot-only. The resolver persists in the singleton's connectors array for the worker lifetime and applies to every subsequent connection.

Parameters

string $driver
Closure $resolver

Return Value

void

in QueueManager at line 461
void addConnector(string $driver, Closure $resolver)

Add a queue connection resolver.

Boot-only. The resolver persists in the singleton's connectors array for the worker lifetime and applies to every subsequent connection.

Parameters

string $driver
Closure $resolver

Return Value

void

in QueueManager at line 469
protected array|null getConfig(string $name)

Get the queue connection configuration.

Parameters

string $name

Return Value

array|null

in QueueManager at line 489
string getDefaultDriver()

Get the name of the default queue connection.

Return Value

string

in QueueManager at line 499
void setDefaultDriver(UnitEnum|string $name)

Set the name of the default queue connection.

Boot-only. Mutates process-global config; per-request use races across coroutines.

Parameters

UnitEnum|string $name

Return Value

void

in QueueManager at line 509
string getName(string|null $connection = null)

Get the full name for the given connection.

Parameters

string|null $connection

Return Value

string

in QueueManager at line 523
void purge(string|null $name = null)

Disconnect a queue connection and close its shared resource pool.

Boot or tests only, plus operational recovery of broken pooled resources. Other connections sharing the pool transparently acquire a fresh pool on their next operation.

Parameters

string|null $name

Return Value

void

in QueueManager at line 559
Container getApplication()

Get the application instance used by the manager.

Return Value

Container

in QueueManager at line 571
QueueManager setApplication(Container $app)

Set the application instance used by the manager.

Tests only. Swaps the container reference on the singleton and on every cached queue connection; per-request use races across coroutines and breaks every concurrent dispatch.

Parameters

Container $app

Return Value

QueueManager

in QueueManager at line 596
void createPayloadUsing(callable|null $callback)

Register a callback to be executed when creating job payloads.

Boot-only. The callback persists in a static property for the worker lifetime and runs on every subsequent payload creation across all coroutines. Passing null clears the registry.

Parameters

callable|null $callback

Return Value

void

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

Override the QueueManager to prevent circular dependency.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

protected mixed getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

Parameters

object $target
string $attributeClass
string|null $property
mixed $default

Return Value

mixed

protected mixed extractAttributeValue(object $instance)

Extract the value from an attribute instance.

Parameters

object $instance

Return Value

mixed

protected object|null getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

Parameters

object $target
string $attributeClass
ReflectionClass|null $declaringClass

Return Value

object|null

protected bool propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

Parameters

object $target
ReflectionClass $reflection
string|null $property
ReflectionClass $attributeDeclaringClass

Return Value

bool

in ReflectsClosures at line 26
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 49
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 75
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 97
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 113
QueueFake except(array|string $jobsToBeQueued)

Specify the jobs that should be queued instead of faked.

Parameters

array|string $jobsToBeQueued

Return Value

QueueFake

at line 123
void assertPushed(Closure|string $job, callable|int|null $callback = null)

Assert if a job was pushed based on a truth-test callback.

Parameters

Closure|string $job
callable|int|null $callback

Return Value

void

at line 143
void assertPushedTimes(string $job, int $times = 1)

Assert if a job was pushed a number of times.

Parameters

string $job
int $times

Return Value

void

at line 161
void assertPushedOnce(string $job)

Assert if a job was pushed exactly once.

Parameters

string $job

Return Value

void

at line 169
void assertPushedOn(UnitEnum|string|null $queue, Closure|string $job, callable|null $callback = null)

Assert if a job was pushed based on a truth-test callback.

Parameters

UnitEnum|string|null $queue
Closure|string $job
callable|null $callback

Return Value

void

at line 192
void assertPushedWithChain(string $job, array $expectedChain = [], callable|null $callback = null)

Assert if a job was pushed with chained jobs based on a truth-test callback.

Parameters

string $job
array $expectedChain
callable|null $callback

Return Value

void

at line 212
void assertPushedWithoutChain(string $job, callable|null $callback = null)

Assert if a job was pushed with an empty chain based on a truth-test callback.

Parameters

string $job
callable|null $callback

Return Value

void

at line 225
protected void assertPushedWithChainOfObjects(string $job, array $expectedChain, callable|null $callback)

Assert if a job was pushed with chained jobs based on a truth-test callback.

Parameters

string $job
array $expectedChain
callable|null $callback

Return Value

void

at line 238
protected void assertPushedWithChainOfClasses(string $job, array $expectedChain, callable|null $callback)

Assert if a job was pushed with chained jobs based on a truth-test callback.

Parameters

string $job
array $expectedChain
callable|null $callback

Return Value

void

at line 255
void assertClosurePushed(callable|int|null $callback = null)

Assert if a closure was pushed based on a truth-test callback.

Parameters

callable|int|null $callback

Return Value

void

at line 263
void assertClosureNotPushed(callable|null $callback = null)

Assert that a closure was not pushed based on a truth-test callback.

Parameters

callable|null $callback

Return Value

void

at line 271
protected bool isChainOfObjects(array $chain)

Determine if the given chain is entirely composed of objects.

Parameters

array $chain

Return Value

bool

at line 279
void assertNotPushed(Closure|string $job, callable|null $callback = null)

Determine if a job was pushed based on a truth-test callback.

Parameters

Closure|string $job
callable|null $callback

Return Value

void

at line 295
void assertCount(int $expectedCount)

Assert the total count of jobs that were pushed.

Parameters

int $expectedCount

Return Value

void

at line 309
void assertNothingPushed()

Assert that no jobs were pushed.

Return Value

void

at line 319
Collection pushed(string $job, callable|null $callback = null)

Get all of the jobs matching a truth-test callback.

Parameters

string $job
callable|null $callback

Return Value

Collection

at line 338
Collection pushedRaw(Closure|null $callback = null)

Get all of the raw pushes matching a truth-test callback.

Parameters

Closure|null $callback

Return Value

Collection

at line 350
Collection listenersPushed(string $listenerClass, callable|null $callback = null)

Get all of the jobs by listener class, passing an optional truth-test callback.

Parameters

string $listenerClass
callable|null $callback

Return Value

Collection

at line 371
bool hasPushed(string $job)

Determine if there are any stored jobs for a given class.

Parameters

string $job

Return Value

bool

at line 387
int size(UnitEnum|string|null $queue = null)

Get the size of the queue.

Parameters

UnitEnum|string|null $queue

Return Value

int

at line 397
int pendingSize(UnitEnum|string|null $queue = null)

Get the number of pending jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

at line 405
int delayedSize(UnitEnum|string|null $queue = null)

Get the number of delayed jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

at line 413
int reservedSize(UnitEnum|string|null $queue = null)

Get the number of reserved jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

at line 421
int totalSize()

Get the number of jobs across every queue.

Return Value

int

at line 431
int totalPendingSize()

Get the number of pending jobs across every queue.

Return Value

int

at line 439
int totalDelayedSize()

Get the number of delayed jobs across every queue.

Return Value

int

at line 447
int totalReservedSize()

Get the number of reserved jobs across every queue.

Return Value

int

at line 457
Collection pendingJobs(UnitEnum|string|null $queue = null)

Get the pending jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

at line 469
Collection delayedJobs(UnitEnum|string|null $queue = null)

Get the delayed jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

at line 481
Collection reservedJobs(UnitEnum|string|null $queue = null)

Get the reserved jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

at line 493
Collection allPendingJobs()

Get all pending jobs across every queue.

Return Value

Collection

at line 503
Collection allDelayedJobs()

Get all delayed jobs across every queue.

Return Value

Collection

at line 513
protected Collection inspectJobs(array $jobs)

Map an array of jobs to a collection of inspected jobs.

Parameters

array $jobs

Return Value

Collection

at line 534
Collection allReservedJobs()

Get all reserved jobs across every queue.

Return Value

Collection

at line 542
protected array pushedJobsWithDelay(bool $delayed)

Get pushed jobs classified by their delay.

Parameters

bool $delayed

Return Value

array

at line 556
int|null creationTimeOfOldestPendingJob(UnitEnum|string|null $queue = null)

Get the creation timestamp of the oldest pending job, excluding delayed jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int|null

at line 567
mixed push(object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue.

Parameters

object|string $job
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

at line 575
protected mixed enqueueUsing(object|string $job, mixed $data, UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int|null $delay)

Push a job through the fake or its underlying queue.

Parameters

object|string $job
mixed $data
UnitEnum|string|null $queue
DateInterval|DateTimeInterface|int|null $delay

Return Value

mixed

at line 631
bool shouldFakeJob(object|string $job)

Determine if a job should be faked or actually dispatched.

Parameters

object|string $job

Return Value

bool

at line 649
protected bool shouldDispatchJob(object|string $job)

Determine if a job should be pushed to the queue instead of faked.

Parameters

object|string $job

Return Value

bool

at line 663
mixed pushRaw(string $payload, UnitEnum|string|null $queue = null, array $options = [])

Push a raw payload onto the queue.

Parameters

string $payload
UnitEnum|string|null $queue
array $options

Return Value

mixed

at line 677
mixed later(DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue after (n) seconds.

Parameters

DateInterval|DateTimeInterface|int $delay
object|string $job
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

at line 689
mixed pushOn(UnitEnum|string|null $queue, object|string $job, mixed $data = '')

Push a new job onto the queue.

Parameters

UnitEnum|string|null $queue
object|string $job
mixed $data

Return Value

mixed

at line 697
mixed laterOn(UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '')

Push a new job onto a specific queue after (n) seconds.

Parameters

UnitEnum|string|null $queue
DateInterval|DateTimeInterface|int $delay
object|string $job
mixed $data

Return Value

mixed

at line 709
void reserve(object|string $job, UnitEnum|string|null $queue = null)

Record the given job as reserved.

Parameters

object|string $job
UnitEnum|string|null $queue

Return Value

void

at line 728
Job|null pop(UnitEnum|string|null $queue = null)

Pop the next job off of the queue.

Parameters

UnitEnum|string|null $queue

Return Value

Job|null

at line 736
mixed bulk(array $jobs, mixed $data = '', UnitEnum|string|null $queue = null)

Push an array of jobs onto the queue.

Parameters

array $jobs
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

at line 754
array pushedJobs()

Get the jobs that have been pushed.

Return Value

array

at line 764
array rawPushes()

Get the payloads that were pushed raw.

Return Value

array

at line 772
QueueFake serializeAndRestore(bool $serializeAndRestore = true)

Specify if jobs should be serialized and restored when being "pushed" to the queue.

Parameters

bool $serializeAndRestore

Return Value

QueueFake

at line 782
protected mixed serializeAndRestoreJob(mixed $job)

Serialize and unserialize the job to simulate the queueing process.

Parameters

mixed $job

Return Value

mixed

at line 790
void releaseUniqueJobLocks()

Release the locks for all unique jobs that were pushed.

Return Value

void

at line 804
void clearReserved()

Clear all of the reserved jobs.

Return Value

void

at line 812
QueueFake beforePushing(callable $callback)

Register a callback to be invoked before pushing a job.

Parameters

callable $callback

Return Value

QueueFake

at line 822
QueueFake afterPushing(callable $callback)

Register a callback to be invoked after pushing a job.

Parameters

callable $callback

Return Value

QueueFake

at line 832
protected string|null normalizeQueue(UnitEnum|string|null $queue)

Normalize a queue identifier.

Parameters

UnitEnum|string|null $queue

Return Value

string|null

at line 840
string getConnectionName()

Get the connection name for the queue.

Return Value

string

at line 848
Queue setConnectionName(string $name)

Set the connection name for the queue.

Parameters

string $name

Return Value

Queue