Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 211 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MockHandler:: (9 methods):
  createWithMiddleware()
  __construct()
  __invoke()
  append()
  getLastRequest()
  getLastOptions()
  count()
  reset()
  invokeStats()


Class: MockHandler  - X-Ref

Handler that returns responses or throw exceptions from a queue.

createWithMiddleware(array $queue = null, callable $onFulfilled = null, callable $onRejected = null)   X-Ref
Creates a new MockHandler that uses the default handler stack list of
middlewares.

param: array|null    $queue       Array of responses, callables, or exceptions.
param: callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
param: callable|null $onRejected  Callback to invoke when the return value is rejected.

__construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null)   X-Ref
The passed in value must be an array of
{@see \Psr\Http\Message\ResponseInterface} objects, Exceptions,
callables, or Promises.

param: array<int, mixed>|null $queue       The parameters to be passed to the append function, as an indexed array.
param: callable|null          $onFulfilled Callback to invoke when the return value is fulfilled.
param: callable|null          $onRejected  Callback to invoke when the return value is rejected.

__invoke(RequestInterface $request, array $options)   X-Ref
No description

append(...$values)   X-Ref
No description

getLastRequest()   X-Ref
Get the last received request.


getLastOptions()   X-Ref
Get the last received request options.


count()   X-Ref
Returns the number of remaining items in the queue.


reset()   X-Ref
No description

invokeStats(RequestInterface $request,array $options,ResponseInterface $response = null,$reason = null)   X-Ref

param: mixed $reason Promise or reason.