Documentation

MockHandler
in package
implements Countable

Handler that returns responses or throw exceptions from a queue.

Tags
final

Interfaces, Classes, Traits and Enums

Countable

Table of Contents

$lastOptions  : array<string|int, mixed>
$lastRequest  : RequestInterface|null
$onFulfilled  : callable|null
$onRejected  : callable|null
$queue  : array<string|int, mixed>
__construct()  : mixed
The passed in value must be an array of {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions, callables, or Promises.
__invoke()  : PromiseInterface
append()  : void
Adds one or more variadic requests, exceptions, callables, or promises to the queue.
count()  : int
Returns the number of remaining items in the queue.
createWithMiddleware()  : HandlerStack
Creates a new MockHandler that uses the default handler stack list of middlewares.
getLastOptions()  : array<string|int, mixed>
Get the last received request options.
getLastRequest()  : RequestInterface|null
Get the last received request.
reset()  : void
invokeStats()  : void

Properties

$lastOptions

private array<string|int, mixed> $lastOptions = []

Methods

__construct()

The passed in value must be an array of {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions, callables, or Promises.

public __construct([array<int, mixed>|null $queue = null ][, callable|null $onFulfilled = null ][, callable|null $onRejected = null ]) : mixed
Parameters
$queue : array<int, mixed>|null = null

The parameters to be passed to the append function, as an indexed array.

$onFulfilled : callable|null = null

Callback to invoke when the return value is fulfilled.

$onRejected : callable|null = null

Callback to invoke when the return value is rejected.

Return values
mixed

append()

Adds one or more variadic requests, exceptions, callables, or promises to the queue.

public append(mixed ...$values) : void
Parameters
$values : mixed
Return values
void

count()

Returns the number of remaining items in the queue.

public count() : int
Return values
int

createWithMiddleware()

Creates a new MockHandler that uses the default handler stack list of middlewares.

public static createWithMiddleware([array<string|int, mixed>|null $queue = null ][, callable|null $onFulfilled = null ][, callable|null $onRejected = null ]) : HandlerStack
Parameters
$queue : array<string|int, mixed>|null = null

Array of responses, callables, or exceptions.

$onFulfilled : callable|null = null

Callback to invoke when the return value is fulfilled.

$onRejected : callable|null = null

Callback to invoke when the return value is rejected.

Return values
HandlerStack

getLastOptions()

Get the last received request options.

public getLastOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

reset()

public reset() : void
Return values
void

Search results