Class MockHandler
Handler that returns responses or throw exceptions from a queue.
-
GuzzleHttp\Handler\MockHandler
implements
Countable
Methods summary
public static
GuzzleHttp\HandlerStack
|
#
createWithMiddleware( array $queue = null, callable $onFulfilled = null, callable $onRejected = null )
Creates a new MockHandler that uses the default handler stack list of
middlewares.
Creates a new MockHandler that uses the default handler stack list of
middlewares.
Parameters
- $queue
- Array of responses, callables, or exceptions.
- $onFulfilled
- Callback to invoke when the return value is fulfilled.
- $onRejected
- Callback to invoke when the return value is rejected.
Returns
|
public
|
#
__construct( array $queue = null, callable $onFulfilled = null, callable $onRejected = null )
The passed in value must be an array of
Psr7\Http\Message\ResponseInterface objects, Exceptions,
callables, or Promises.
The passed in value must be an array of
Psr7\Http\Message\ResponseInterface objects, Exceptions,
callables, or Promises.
Parameters
- $queue
- $onFulfilled
- Callback to invoke when the return value is fulfilled.
- $onRejected
- Callback to invoke when the return value is rejected.
|
public
|
|
public
|
#
append( )
Adds one or more variadic requests, exceptions, callables, or promises
to the queue.
Adds one or more variadic requests, exceptions, callables, or promises
to the queue.
|
public
Psr\Http\Message\RequestInterface
|
#
getLastRequest( )
Get the last received request.
Get the last received request.
Returns
|
public
Psr\Http\Message\RequestInterface
|
#
getLastOptions( )
Get the last received request options.
Get the last received request options.
Returns
|
public
integer
|
#
count( )
Returns the number of remaining items in the queue.
Returns the number of remaining items in the queue.
Returns
integer
Implementation of
Countable::count()
|