Implements sending requests to an array of stubbed responses
This adapter is not intended for production use. Instead it is the backend used by Client::addMockResponse()
array
List of mocked responses.
Add a mocked response.
Find a response if one exists.
Check if the request URI matches the mock URI.
addResponse(Psr\Http\Message\RequestInterface $request, Cake\Http\Client\Response $response, array<string, mixed> $options): void
Add a mocked response.
match
An additional closure to match requests with.Psr\Http\Message\RequestInterface
$request A partial request to use for matching.
Cake\Http\Client\Response
$response The response that matches the request.
array<string, mixed>
$options See above.
void
send(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): Cake\Http\Client\Response[]
Find a response if one exists.
Psr\Http\Message\RequestInterface
$request The request to match
array<string, mixed>
$options Unused.
Cake\Http\Client\Response[]
urlMatches(string $requestUri, Psr\Http\Message\RequestInterface $mock): bool
Check if the request URI matches the mock URI.
string
$requestUri The request being sent.
Psr\Http\Message\RequestInterface
$mock The request being mocked.
bool
List of mocked responses.
array
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Http.Client.Adapter.Mock.html