api/laravel/Support/Sleep.yaml
2024-09-26 02:03:21 -07:00

363 lines
7.5 KiB
YAML

name: Sleep
class_comment: null
dependencies:
- name: CarbonInterval
type: class
source: Carbon\CarbonInterval
- name: DateInterval
type: class
source: DateInterval
- name: Macroable
type: class
source: Illuminate\Support\Traits\Macroable
- name: PHPUnit
type: class
source: PHPUnit\Framework\Assert
- name: RuntimeException
type: class
source: RuntimeException
- name: Macroable
type: class
source: Macroable
properties:
- name: fakeSleepCallbacks
visibility: public
comment: '# * The fake sleep callbacks.
# *
# * @var array'
- name: syncWithCarbon
visibility: protected
comment: '# * Keep Carbon''s "now" in sync when sleeping.
# *
# * @var bool'
- name: duration
visibility: public
comment: '# * The total duration to sleep.
# *
# * @var \Carbon\CarbonInterval'
- name: pending
visibility: protected
comment: '# * The pending duration to sleep.
# *
# * @var int|float|null'
- name: fake
visibility: protected
comment: '# * Indicates that all sleeping should be faked.
# *
# * @var bool'
- name: sequence
visibility: protected
comment: '# * The sequence of sleep durations encountered while faking.
# *
# * @var array<int, \Carbon\CarbonInterval>'
- name: shouldSleep
visibility: protected
comment: '# * Indicates if the instance should sleep.
# *
# * @var bool'
methods:
- name: __construct
visibility: public
parameters:
- name: duration
comment: "# * The fake sleep callbacks.\n# *\n# * @var array\n# */\n# public static\
\ $fakeSleepCallbacks = [];\n# \n# /**\n# * Keep Carbon's \"now\" in sync when\
\ sleeping.\n# *\n# * @var bool\n# */\n# protected static $syncWithCarbon = false;\n\
# \n# /**\n# * The total duration to sleep.\n# *\n# * @var \\Carbon\\CarbonInterval\n\
# */\n# public $duration;\n# \n# /**\n# * The pending duration to sleep.\n# *\n\
# * @var int|float|null\n# */\n# protected $pending = null;\n# \n# /**\n# * Indicates\
\ that all sleeping should be faked.\n# *\n# * @var bool\n# */\n# protected static\
\ $fake = false;\n# \n# /**\n# * The sequence of sleep durations encountered while\
\ faking.\n# *\n# * @var array<int, \\Carbon\\CarbonInterval>\n# */\n# protected\
\ static $sequence = [];\n# \n# /**\n# * Indicates if the instance should sleep.\n\
# *\n# * @var bool\n# */\n# protected $shouldSleep = true;\n# \n# /**\n# * Create\
\ a new class instance.\n# *\n# * @param int|float|\\DateInterval $duration\n\
# * @return void"
- name: for
visibility: public
parameters:
- name: duration
comment: '# * Sleep for the given duration.
# *
# * @param \DateInterval|int|float $duration
# * @return static'
- name: until
visibility: public
parameters:
- name: timestamp
comment: '# * Sleep until the given timestamp.
# *
# * @param \DateTimeInterface|int|float|numeric-string $timestamp
# * @return static'
- name: usleep
visibility: public
parameters:
- name: duration
comment: '# * Sleep for the given number of microseconds.
# *
# * @param int $duration
# * @return static'
- name: sleep
visibility: public
parameters:
- name: duration
comment: '# * Sleep for the given number of seconds.
# *
# * @param int|float $duration
# * @return static'
- name: duration
visibility: protected
parameters:
- name: duration
comment: '# * Sleep for the given duration. Replaces any previously defined duration.
# *
# * @param \DateInterval|int|float $duration
# * @return $this'
- name: minutes
visibility: public
parameters: []
comment: '# * Sleep for the given number of minutes.
# *
# * @return $this'
- name: minute
visibility: public
parameters: []
comment: '# * Sleep for one minute.
# *
# * @return $this'
- name: seconds
visibility: public
parameters: []
comment: '# * Sleep for the given number of seconds.
# *
# * @return $this'
- name: second
visibility: public
parameters: []
comment: '# * Sleep for one second.
# *
# * @return $this'
- name: milliseconds
visibility: public
parameters: []
comment: '# * Sleep for the given number of milliseconds.
# *
# * @return $this'
- name: millisecond
visibility: public
parameters: []
comment: '# * Sleep for one millisecond.
# *
# * @return $this'
- name: microseconds
visibility: public
parameters: []
comment: '# * Sleep for the given number of microseconds.
# *
# * @return $this'
- name: microsecond
visibility: public
parameters: []
comment: '# * Sleep for on microsecond.
# *
# * @return $this'
- name: and
visibility: public
parameters:
- name: duration
comment: '# * Add additional time to sleep for.
# *
# * @param int|float $duration
# * @return $this'
- name: __destruct
visibility: public
parameters: []
comment: '# * Handle the object''s destruction.
# *
# * @return void'
- name: pullPending
visibility: protected
parameters: []
comment: '# * Resolve the pending duration.
# *
# * @return int|float'
- name: fake
visibility: public
parameters:
- name: value
default: 'true'
- name: syncWithCarbon
default: 'false'
comment: '# * Stay awake and capture any attempts to sleep.
# *
# * @param bool $value
# * @param bool $syncWithCarbon
# * @return void'
- name: assertSlept
visibility: public
parameters:
- name: expected
- name: times
default: '1'
comment: '# * Assert a given amount of sleeping occurred a specific number of times.
# *
# * @param \Closure $expected
# * @param int $times
# * @return void'
- name: assertSleptTimes
visibility: public
parameters:
- name: expected
comment: '# * Assert sleeping occurred a given number of times.
# *
# * @param int $expected
# * @return void'
- name: assertSequence
visibility: public
parameters:
- name: sequence
comment: '# * Assert the given sleep sequence was encountered.
# *
# * @param array $sequence
# * @return void'
- name: assertNeverSlept
visibility: public
parameters: []
comment: '# * Assert that no sleeping occurred.
# *
# * @return void'
- name: assertInsomniac
visibility: public
parameters: []
comment: '# * Assert that no sleeping occurred.
# *
# * @return void'
- name: shouldNotSleep
visibility: protected
parameters: []
comment: '# * Indicate that the instance should not sleep.
# *
# * @return $this'
- name: when
visibility: public
parameters:
- name: condition
comment: '# * Only sleep when the given condition is true.
# *
# * @param (\Closure($this): bool)|bool $condition
# * @return $this'
- name: unless
visibility: public
parameters:
- name: condition
comment: '# * Don''t sleep when the given condition is true.
# *
# * @param (\Closure($this): bool)|bool $condition
# * @return $this'
- name: whenFakingSleep
visibility: public
parameters:
- name: callback
comment: '# * Specify a callback that should be invoked when faking sleep within
a test.
# *
# * @param callable $callback
# * @return void'
- name: syncWithCarbon
visibility: public
parameters:
- name: value
default: 'true'
comment: '# * Indicate that Carbon''s "now" should be kept in sync when sleeping.
# *
# * @return void'
traits:
- Carbon\CarbonInterval
- DateInterval
- Illuminate\Support\Traits\Macroable
- RuntimeException
- Macroable
interfaces: []