class MailchimpTestHttpClient in Mailchimp 8
A dummy HTTP client used when running unit tests. Does not make any real API requests.
@package Mailchimp\Tests
Hierarchy
- class \Mailchimp\Tests\MailchimpTestHttpClient implements MailchimpHttpClientInterface
Expanded class hierarchy of MailchimpTestHttpClient
File
- lib/
mailchimp-api-php/ tests/ src/ MailchimpTestHttpClient.php, line 16
Namespace
Mailchimp\TestsView source
class MailchimpTestHttpClient implements MailchimpHttpClientInterface {
public $method;
public $uri;
public $options;
/**
* @inheritdoc
*/
public function handleRequest($method, $uri = '', $options = [], $parameters = [], $returnAssoc = FALSE) {
if (!empty($parameters)) {
if ($method == 'GET') {
// Send parameters as query string parameters.
$options['query'] = $parameters;
}
else {
// Send parameters as JSON in request body.
$options['json'] = (object) $parameters;
}
}
$this->method = $method;
$this->uri = $uri;
$this->options = $options;
return new MailchimpTestHttpResponse();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MailchimpTestHttpClient:: |
public | property | ||
MailchimpTestHttpClient:: |
public | property | ||
MailchimpTestHttpClient:: |
public | property | ||
MailchimpTestHttpClient:: |
public | function |
@inheritdoc Overrides MailchimpHttpClientInterface:: |