class Illuminate / Support / Sleep
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Sleep

Uses

Properties

public static

$fakeSleepCallbacks array

The fake sleep callbacks.

Default: []
public

$duration Carbon\CarbonInterval

The total duration to sleep.

Default: null
protected

$pending int|float|null

The pending duration to sleep.

Default: null
protected static

$fake bool

Indicates that all sleeping should be faked.

Default: false
protected static

$sequence array

The sequence of sleep durations encountered while faking.

Default: []
protected

$shouldSleep bool

Indicates if the instance should sleep.

Default: true

Methods

public

__construct ( $duration ) : void

Create a new class instance.

Parameters

public static

for ( $duration ) : static

Sleep for the given duration.

Parameters

public static

until ( $timestamp ) : static

Sleep until the given timestamp.

Parameters

public static

usleep ( $duration ) : static

Sleep for the given number of microseconds.

Parameters

  • $duration int
public static

sleep ( $duration ) : static

Sleep for the given number of seconds.

Parameters

  • $duration int|float
protected

duration ( $duration ) : $this

Sleep for the given duration. Replaces any previously defined duration.

Parameters

public

minutes ( ) : $this

Sleep for the given number of minutes.

public

minute ( ) : $this

Sleep for one minute.

public

seconds ( ) : $this

Sleep for the given number of seconds.

public

second ( ) : $this

Sleep for one second.

public

milliseconds ( ) : $this

Sleep for the given number of milliseconds.

public

millisecond ( ) : $this

Sleep for one millisecond.

public

microseconds ( ) : $this

Sleep for the given number of microseconds.

public

microsecond ( ) : $this

Sleep for on microsecond.

public

and ( $duration ) : $this

Add additional time to sleep for.

Parameters

  • $duration int|float
public

__destruct ( ) : void

Handle the object's destruction.

protected

pullPending ( ) : int|float

Resolve the pending duration.

public static

fake ( $value ) : void

Stay awake and capture any attempts to sleep.

Parameters

  • $value bool
public static

assertSlept ( $expected , $times ) : void

Assert a given amount of sleeping occurred a specific number of times.

Parameters

public static

assertSleptTimes ( $expected ) : void

Assert sleeping occurred a given number of times.

Parameters

  • $expected int
public static

assertSequence ( $sequence ) : void

Assert the given sleep sequence was encountered.

Parameters

  • $sequence array
public static

assertNeverSlept ( ) : void

Assert that no sleeping occurred.

public static

assertInsomniac ( ) : void

Assert that no sleeping occurred.

protected

shouldNotSleep ( ) : $this

Indicate that the instance should not sleep.

public

when ( $condition ) : $this

Only sleep when the given condition is true.

Parameters

  • $condition callable|bool
public

unless ( $condition ) : $this

Don't sleep when the given condition is true.

Parameters

  • $condition callable|bool
public static

whenFakingSleep ( $callback ) : void

Specify a callback that should be invoked when faking sleep within a test.

Parameters

  • $callback callable