On this page
BatchFake
class BatchFake extends Batch (View source)
Properties
protected Factory | $queue | The queue factory implementation. |
from Batch |
protected BatchRepository | $repository | The repository implementation. |
from Batch |
string | $id | The batch ID. |
from Batch |
string | $name | The batch name. |
from Batch |
int | $totalJobs | The total number of jobs that belong to the batch. |
from Batch |
int | $pendingJobs | The total number of jobs that are still pending. |
from Batch |
int | $failedJobs | The total number of jobs that have failed. |
from Batch |
array | $failedJobIds | The IDs of the jobs that have failed. |
from Batch |
array | $options | The batch options. |
from Batch |
CarbonImmutable | $createdAt | The date indicating when the batch was created. |
from Batch |
CarbonImmutable|null | $cancelledAt | The date indicating when the batch was cancelled. |
from Batch |
CarbonImmutable|null | $finishedAt | The date indicating when the batch was finished. |
from Batch |
array | $added | The jobs that have been added to the batch. |
|
bool | $deleted | Indicates if the batch has been deleted. |
Methods
void | __construct(string $id, string $name, int $totalJobs, int $pendingJobs, int $failedJobs, array $failedJobIds, array $options, CarbonImmutable $createdAt, CarbonImmutable|null $cancelledAt = null, CarbonImmutable|null $finishedAt = null) Create a new batch instance. |
|
Batch | fresh() Get a fresh instance of the batch represented by this ID. |
|
Batch | add(Enumerable|object|array $jobs) Add additional jobs to the batch. |
|
Collection | prepareBatchedChain(array $chain) Prepare a chain that exists within the jobs being added. |
from Batch |
int | processedJobs() Get the total number of jobs that have been processed by the batch thus far. |
from Batch |
int | progress() Get the percentage of jobs that have been processed (between 0-100). |
from Batch |
void | recordSuccessfulJob(string $jobId) Record that a job within the batch finished successfully, executing any callbacks if necessary. |
|
UpdatedBatchJobCounts | decrementPendingJobs(string $jobId) Decrement the pending jobs for the batch. |
|
bool | finished() Determine if the batch has finished executing. |
from Batch |
bool | hasThenCallbacks() Determine if the batch has "success" callbacks. |
from Batch |
bool | allowsFailures() Determine if the batch allows jobs to fail without cancelling the batch. |
from Batch |
bool | hasFailures() Determine if the batch has job failures. |
from Batch |
void | recordFailedJob(string $jobId, Throwable $e) Record that a job within the batch failed to finish successfully, executing any callbacks if necessary. |
|
UpdatedBatchJobCounts | incrementFailedJobs(string $jobId) Increment the failed jobs for the batch. |
|
bool | hasCatchCallbacks() Determine if the batch has "catch" callbacks. |
from Batch |
bool | hasFinallyCallbacks() Determine if the batch has "finally" callbacks. |
from Batch |
void | cancel() Cancel the batch. |
|
bool | canceled() Determine if the batch has been cancelled. |
from Batch |
bool | cancelled() Determine if the batch has been cancelled. |
from Batch |
void | delete() Delete the batch from storage. |
|
void | invokeHandlerCallback(callable $handler, Batch $batch, Throwable $e = null) Invoke a batch callback handler. |
from Batch |
toArray() Convert the batch to an array. |
from Batch | |
array | jsonSerialize() Get the JSON serializable representation of the object. |
from Batch |
mixed | __get(string $key) Dynamically access the batch's "options" via properties. |
from Batch |
bool | deleted() Determine if the batch has been deleted. |
Details
void __construct(string $id, string $name, int $totalJobs, int $pendingJobs, int $failedJobs, array $failedJobIds, array $options, CarbonImmutable $createdAt, CarbonImmutable|null $cancelledAt = null, CarbonImmutable|null $finishedAt = null)
Create a new batch instance.
Batch fresh()
Get a fresh instance of the batch represented by this ID.
Batch add(Enumerable|object|array $jobs)
Add additional jobs to the batch.
protected Collection prepareBatchedChain(array $chain)
Prepare a chain that exists within the jobs being added.
int processedJobs()
Get the total number of jobs that have been processed by the batch thus far.
int progress()
Get the percentage of jobs that have been processed (between 0-100).
void recordSuccessfulJob(string $jobId)
Record that a job within the batch finished successfully, executing any callbacks if necessary.
UpdatedBatchJobCounts decrementPendingJobs(string $jobId)
Decrement the pending jobs for the batch.
bool finished()
Determine if the batch has finished executing.
bool hasThenCallbacks()
Determine if the batch has "success" callbacks.
bool allowsFailures()
Determine if the batch allows jobs to fail without cancelling the batch.
bool hasFailures()
Determine if the batch has job failures.
void recordFailedJob(string $jobId, Throwable $e)
Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.
UpdatedBatchJobCounts incrementFailedJobs(string $jobId)
Increment the failed jobs for the batch.
bool hasCatchCallbacks()
Determine if the batch has "catch" callbacks.
bool hasFinallyCallbacks()
Determine if the batch has "finally" callbacks.
void cancel()
Cancel the batch.
bool canceled()
Determine if the batch has been cancelled.
bool cancelled()
Determine if the batch has been cancelled.
void delete()
Delete the batch from storage.
protected void invokeHandlerCallback(callable $handler, Batch $batch, Throwable $e = null)
Invoke a batch callback handler.
toArray()
Convert the batch to an array.
array jsonSerialize()
Get the JSON serializable representation of the object.
mixed __get(string $key)
Dynamically access the batch's "options" via properties.
bool deleted()
Determine if the batch has been deleted.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Support/Testing/Fakes/BatchFake.html