Larabros\Elogram\Http\Clients\MockAdapter

class MockAdapter

A mock HTTP client adapter.

property fixturesPath

protected string

__construct($fixturesPath)

Creates a new instance of MockAdapter.

Parameters:
  • $fixturesPath (string) –
request($method, $uri, $parameters =[])

{@inheritDoc}

Parameters:
  • $method
  • $uri
  • $parameters
mapRequestToFile($method, $uri, $parameters)

Parse the correct filename from the request.

Parameters:
  • $method (string) –
  • $uri (string) –
  • $parameters
Returns:

string

cleanPath($uri)

Removes any unwanted suffixes and values from a URL path.

Parameters:
  • $uri
Returns:

string

mapRequestParameters($parameters)

Parses any filename properties from the request parameters.

Parameters:
  • $parameters
Returns:

string

paginate(Response $response, $limit = null)

{@inheritDoc}

Parameters:
resolveExceptionClass(ClientException $exception)

Parses a ClientException for any specific exceptions thrown by the API in the response body. If the response body is not in JSON format, an Exception is returned.

Check a ClientException to see if it has an associated ResponseInterface object.

Parameters:
  • $exception (ClientException) –
Returns:

Exception