trait InteractsWithQueue

Traits

Properties

Job|null $job

The underlying queue job instance.

Methods

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

int
attempts()

Get the number of times the job has been attempted.

void
delete()

Delete the job from the queue.

void
fail(string|Throwable|null $exception = null)

Fail the job from the queue.

void
release(DateInterval|DateTimeInterface|int $delay = 0)

Release the job back into the queue after (n) seconds.

withFakeQueueInteractions()

Indicate that queue interactions like fail, delete, and release should be faked.

assertDeleted()

Assert that the job was deleted from the queue.

assertNotDeleted()

Assert that the job was not deleted from the queue.

assertFailed()

Assert that the job was manually failed.

assertFailedWith(string|Throwable $exception)

Assert that the job was manually failed with a specific exception.

assertNotFailed()

Assert that the job was not manually failed.

assertReleased(DateInterval|DateTimeInterface|int|null $delay = null)

Assert that the job was released back onto the queue.

assertNotReleased()

Assert that the job was not released back onto the queue.

setJob(Job $job)

Set the base queue job instance.

Details

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

in InteractsWithTime at line 41
protected DateTimeInterface|int parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 57
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

in InteractsWithTime at line 65
protected string runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

Parameters

float $startTime
float|null $endTime

Return Value

string

at line 28
int attempts()

Get the number of times the job has been attempted.

Return Value

int

at line 36
void delete()

Delete the job from the queue.

Return Value

void

at line 47
void fail(string|Throwable|null $exception = null)

Fail the job from the queue.

Parameters

string|Throwable|null $exception

Return Value

void

at line 61
void release(DateInterval|DateTimeInterface|int $delay = 0)

Release the job back into the queue after (n) seconds.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

void

at line 74
InteractsWithQueue withFakeQueueInteractions()

Indicate that queue interactions like fail, delete, and release should be faked.

Return Value

InteractsWithQueue

at line 84
InteractsWithQueue assertDeleted()

Assert that the job was deleted from the queue.

Return Value

InteractsWithQueue

at line 99
InteractsWithQueue assertNotDeleted()

Assert that the job was not deleted from the queue.

Return Value

InteractsWithQueue

at line 114
InteractsWithQueue assertFailed()

Assert that the job was manually failed.

Return Value

InteractsWithQueue

at line 129
InteractsWithQueue assertFailedWith(string|Throwable $exception)

Assert that the job was manually failed with a specific exception.

Parameters

string|Throwable $exception

Return Value

InteractsWithQueue

at line 171
InteractsWithQueue assertNotFailed()

Assert that the job was not manually failed.

Return Value

InteractsWithQueue

at line 186
InteractsWithQueue assertReleased(DateInterval|DateTimeInterface|int|null $delay = null)

Assert that the job was released back onto the queue.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

InteractsWithQueue

at line 211
InteractsWithQueue assertNotReleased()

Assert that the job was not released back onto the queue.

Return Value

InteractsWithQueue

at line 236
InteractsWithQueue setJob(Job $job)

Set the base queue job instance.

Parameters

Job $job

Return Value

InteractsWithQueue