QueueFake
class QueueFake extends QueueManager implements Fake, Queue (View source)
Traits
Properties
protected Application | $app | The application instance. |
from QueueManager |
protected array | $connections | The array of resolved queue connections. |
from QueueManager |
protected array | $connectors | The array of resolved queue connectors. |
from QueueManager |
Queue | $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. |
Methods
Create a new fake queue instance.
Register an event listener for the exception occurred job event.
Register an event listener for the daemon queue loop.
Register an event listener for the failed job event.
Register an event listener for the daemon queue stopping.
Resolve a queue connection instance.
Get the connector for a given driver.
Get the full name for the given connection.
Override the QueueManager to prevent circular dependency.
Get the class name of the first parameter of the given Closure.
Get the class names of the first parameter of the given Closure, including union types.
Get the class names / types of the parameters of the given Closure.
Specify the jobs that should be queued instead of faked.
Assert if a job was pushed based on a truth-test callback.
Assert if a job was pushed a number of times.
Assert if a job was pushed based on a truth-test callback.
Assert if a job was pushed with chained jobs based on a truth-test callback.
Assert if a job was pushed with an empty chain based on a truth-test callback.
Assert if a job was pushed with chained jobs based on a truth-test callback.
Assert if a job was pushed with chained jobs based on a truth-test callback.
Assert if a closure was pushed based on a truth-test callback.
Assert that a closure was not pushed based on a truth-test callback.
Determine if the given chain is entirely composed of objects.
Determine if a job was pushed based on a truth-test callback.
Assert that no jobs were pushed.
Get all of the jobs matching a truth-test callback.
Determine if there are any stored jobs for a given class.
Get the size of the queue.
Push a new job onto the queue.
Determine if a job should be faked or actually dispatched.
Determine if a job should be pushed to the queue instead of faked.
Push a raw payload onto the queue.
Push a new job onto the queue after (n) seconds.
Push a new job onto the queue.
Push a new job onto a specific queue after (n) seconds.
Push an array of jobs onto the queue.
Get the jobs that have been pushed.
Get the connection name for the queue.
Set the connection name for the queue.
Details
void
__construct(Application $app, array $jobsToFake = [], QueueManager|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
stopping(mixed $callback)
Register an event listener for the daemon queue stopping.
bool
connected(string|null $name = null)
Determine if the driver is connected.
Queue
connection(mixed $value = null)
Resolve a queue connection instance.
protected Queue
resolve(string $name)
Resolve a queue connection.
protected ConnectorInterface
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.
protected array|null
getConfig(string $name)
Get the queue connection configuration.
string
getDefaultDriver()
Get the name of the default queue connection.
void
setDefaultDriver(string $name)
Set the name of the default queue connection.
string
getName(string|null $connection = null)
Get the full name for the given connection.
Application
getApplication()
Get the application instance used by the manager.
$this
setApplication(Application $app)
Set the application instance used by the manager.
mixed
__call(string $method, array $parameters)
Override the QueueManager to prevent circular dependency.
protected string
firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure.
protected array
firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types.
protected array
closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure.
$this
except(array|string $jobsToBeQueued)
Specify the jobs that should be queued instead of faked.
void
assertPushed(string|Closure $job, callable|int|null $callback = null)
Assert if a job was pushed based on a truth-test callback.
protected void
assertPushedTimes(string $job, int $times = 1)
Assert if a job was pushed a number of times.
void
assertPushedOn(string $queue, string|Closure $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.
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.
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.
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.
protected bool
isChainOfObjects(array $chain)
Determine if the given chain is entirely composed of objects.
void
assertNotPushed(string|Closure $job, callable|null $callback = null)
Determine if a job was pushed based on a truth-test callback.
void
assertNothingPushed()
Assert that no jobs were pushed.
Collection
pushed(string $job, callable|null $callback = null)
Get all of the jobs matching a truth-test callback.
bool
hasPushed(string $job)
Determine if there are any stored jobs for a given class.
int
size(string|null $queue = null)
Get the size of the queue.
mixed
push(string|object $job, mixed $data = '', string|null $queue = null)
Push a new job onto the queue.
bool
shouldFakeJob(object $job)
Determine if a job should be faked or actually dispatched.
protected bool
shouldDispatchJob(object $job)
Determine if a job should be pushed to the queue instead of faked.
mixed
pushRaw(string $payload, string|null $queue = null, array $options = [])
Push a raw payload onto the queue.
mixed
later(DateTimeInterface|DateInterval|int $delay, string|object $job, mixed $data = '', string|null $queue = null)
Push a new job onto the queue after (n) seconds.
mixed
pushOn(string $queue, string|object $job, mixed $data = '')
Push a new job onto the queue.
mixed
laterOn(string $queue, DateTimeInterface|DateInterval|int $delay, string|object $job, mixed $data = '')
Push a new job onto a specific queue after (n) seconds.
Job|null
pop(string|null $queue = null)
Pop the next job off of the queue.
mixed
bulk(array $jobs, mixed $data = '', string|null $queue = null)
Push an array of jobs onto the queue.
array
pushedJobs()
Get the jobs that have been pushed.
string
getConnectionName()
Get the connection name for the queue.
$this
setConnectionName(string $name)
Set the connection name for the queue.