class BusFake implements Fake, QueueingDispatcher (View source)
| ReflectsClosures |
| QueueingDispatcher | $dispatcher | The original Bus dispatcher implementation. | |
| protected array | $jobsToFake | The job types that should be intercepted instead of dispatched. | |
| protected array | $jobsToDispatch | The job types that should be dispatched instead of faked. | |
| protected BatchRepository | $batchRepository | The fake repository to track batched jobs. | |
| protected array | $commands | The commands that have been dispatched. | |
| protected array | $commandsSync | The commands that have been dispatched synchronously. | |
| protected array | $commandsAfterResponse | The commands that have been dispatched after the response has been sent. | |
| protected array | $batches | The batches that have been dispatched. | |
| protected bool | $serializeAndRestore | Indicates if commands should be serialized and restored when pushed to the Bus. |
| string | firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure. | from ReflectsClosures |
| array | firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types. | from ReflectsClosures |
| array | closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure. | from ReflectsClosures |
| void | __construct(QueueingDispatcher $dispatcher, array|string $jobsToFake = [], BatchRepository|null $batchRepository = null)
Create a new bus fake instance. | |
| $this | except(array|string $jobsToDispatch)
Specify the jobs that should be dispatched instead of faked. | |
| void | assertDispatched(string|Closure $command, callable|int|null $callback = null)
Assert if a job was dispatched based on a truth-test callback. | |
| void | assertDispatchedTimes(string|Closure $command, int $times = 1)
Assert if a job was pushed a number of times. | |
| void | assertNotDispatched(string|Closure $command, callable|null $callback = null)
Determine if a job was dispatched based on a truth-test callback. | |
| void | assertNothingDispatched()
Assert that no jobs were dispatched. | |
| void | assertDispatchedSync(string|Closure $command, callable|int|null $callback = null)
Assert if a job was explicitly dispatched synchronously based on a truth-test callback. | |
| void | assertDispatchedSyncTimes(string|Closure $command, int $times = 1)
Assert if a job was pushed synchronously a number of times. | |
| void | assertNotDispatchedSync(string|Closure $command, callable|null $callback = null)
Determine if a job was dispatched based on a truth-test callback. | |
| void | assertDispatchedAfterResponse(string|Closure $command, callable|int|null $callback = null)
Assert if a job was dispatched after the response was sent based on a truth-test callback. | |
| void | assertDispatchedAfterResponseTimes(string|Closure $command, int $times = 1)
Assert if a job was pushed after the response was sent a number of times. | |
| void | assertNotDispatchedAfterResponse(string|Closure $command, callable|null $callback = null)
Determine if a job was dispatched based on a truth-test callback. | |
| void | assertChained(array $expectedChain)
Assert if a chain of jobs was dispatched. | |
| mixed | resetChainPropertiesToDefaults(mixed $job)
Reset the chain properties to their default values on the job. | |
| void | assertDispatchedWithoutChain(string|Closure $command, callable|null $callback = null)
Assert if a job was dispatched with an empty chain based on a truth-test callback. | |
| void | assertDispatchedWithChainOfObjects(string $command, array $expectedChain, callable|null $callback)
Assert if a job was dispatched with chained jobs based on a truth-test callback. | |
| ChainedBatchTruthTest | chainedBatch(Closure $callback)
Create a new assertion about a chained batch. | |
| void | assertBatched(callable $callback)
Assert if a batch was dispatched based on a truth-test callback. | |
| void | assertBatchCount(int $count)
Assert the number of batches that have been dispatched. | |
| void | assertNothingBatched()
Assert that no batched jobs were dispatched. | |
| Collection | dispatched(string $command, callable|null $callback = null)
Get all of the jobs matching a truth-test callback. | |
| Collection | dispatchedSync(string $command, callable|null $callback = null)
Get all of the jobs dispatched synchronously matching a truth-test callback. | |
| Collection | dispatchedAfterResponse(string $command, callable|null $callback = null)
Get all of the jobs dispatched after the response was sent matching a truth-test callback. | |
| Collection | batched(callable $callback)
Get all of the pending batches matching a truth-test callback. | |
| bool | hasDispatched(string $command)
Determine if there are any stored commands for a given class. | |
| bool | hasDispatchedSync(string $command)
Determine if there are any stored commands for a given class. | |
| bool | hasDispatchedAfterResponse(string $command)
Determine if there are any stored commands for a given class. | |
| mixed | dispatch(mixed $command)
Dispatch a command to its appropriate handler. | |
| mixed | dispatchSync(mixed $command, mixed $handler = null)
Dispatch a command to its appropriate handler in the current process. | |
| mixed | dispatchNow(mixed $command, mixed $handler = null)
Dispatch a command to its appropriate handler in the current process. | |
| mixed | dispatchToQueue(mixed $command)
Dispatch a command to its appropriate handler behind a queue. | |
| mixed | dispatchAfterResponse(mixed $command)
Dispatch a command to its appropriate handler. | |
| PendingChain | chain(Collection|array $jobs)
Create a new chain of queueable jobs. | |
| Batch|null | findBatch(string $batchId)
Attempt to find the batch with the given ID. | |
| PendingBatch | batch(Collection|array $jobs)
Create a new batch of queueable jobs. | |
| Batch | dispatchFakeBatch(string $name = '')
Dispatch an empty job batch for testing. | |
| Batch | recordPendingBatch(PendingBatch $pendingBatch)
Record the fake pending batch dispatch. | |
| bool | shouldFakeJob(mixed $command)
Determine if a command should be faked or actually dispatched. | |
| bool | shouldDispatchCommand(mixed $command)
Determine if a command should be dispatched or not. | |
| $this | serializeAndRestore(bool $serializeAndRestore = true)
Specify if commands should be serialized and restored when being batched. | |
| mixed | serializeAndRestoreCommand(mixed $command)
Serialize and unserialize the command to simulate the queueing process. | |
| mixed | getCommandRepresentation(mixed $command)
Return the command representation that should be stored. | |
| $this | pipeThrough(array $pipes)
Set the pipes commands should be piped through before dispatching. | |
| bool | hasCommandHandler(mixed $command)
Determine if the given command has a handler. | |
| bool|mixed | getCommandHandler(mixed $command)
Retrieve the handler for a command. | |
| $this | map(array $map)
Map a command to a handler. |
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.
Create a new bus fake instance.
Specify the jobs that should be dispatched instead of faked.
Assert if a job was dispatched based on a truth-test callback.
Assert if a job was pushed a number of times.
Determine if a job was dispatched based on a truth-test callback.
Assert that no jobs were dispatched.
Assert if a job was explicitly dispatched synchronously based on a truth-test callback.
Assert if a job was pushed synchronously a number of times.
Determine if a job was dispatched based on a truth-test callback.
Assert if a job was dispatched after the response was sent based on a truth-test callback.
Assert if a job was pushed after the response was sent a number of times.
Determine if a job was dispatched based on a truth-test callback.
Assert if a chain of jobs was dispatched.
Reset the chain properties to their default values on the job.
Assert if a job was dispatched with an empty chain based on a truth-test callback.
Assert if a job was dispatched with chained jobs based on a truth-test callback.
Create a new assertion about a chained batch.
Assert if a batch was dispatched based on a truth-test callback.
Assert the number of batches that have been dispatched.
Assert that no batched jobs were dispatched.
Get all of the jobs matching a truth-test callback.
Get all of the jobs dispatched synchronously matching a truth-test callback.
Get all of the jobs dispatched after the response was sent matching a truth-test callback.
Get all of the pending batches matching a truth-test callback.
Determine if there are any stored commands for a given class.
Determine if there are any stored commands for a given class.
Determine if there are any stored commands for a given class.
Dispatch a command to its appropriate handler.
Dispatch a command to its appropriate handler in the current process.
Queueable jobs will be dispatched to the "sync" queue.
Dispatch a command to its appropriate handler in the current process.
Dispatch a command to its appropriate handler behind a queue.
Dispatch a command to its appropriate handler.
Create a new chain of queueable jobs.
Attempt to find the batch with the given ID.
Create a new batch of queueable jobs.
Dispatch an empty job batch for testing.
Record the fake pending batch dispatch.
Determine if a command should be faked or actually dispatched.
Determine if a command should be dispatched or not.
Specify if commands should be serialized and restored when being batched.
Serialize and unserialize the command to simulate the queueing process.
Return the command representation that should be stored.
Set the pipes commands should be piped through before dispatching.
Determine if the given command has a handler.
Retrieve the handler for a command.
Map a command to a handler.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Support/Testing/Fakes/BusFake.html