Fully Qualified Name: | Zend\Http\Client\Adapter\Test |
Implements: | AdapterInterface |
A testing-purposes adapter.
Should be used to test all components that rely on Zend\Http\Client, without actually performing an HTTP request. You should instantiate this object manually, and then set it as the client's adapter. Then, you can set the expected response using the setResponse() method.
Name | Description | Defined By |
---|---|---|
__construct() | Adapter constructor, currently empty. Config is set using setOptions() | Test |
addResponse() | Add another response to the response buffer. | Test |
close() | Close the connection (dummy) | Test |
connect() | Connect to the remote server | Test |
read() | Return the response set in $this->setResponse() | Test |
setNextRequestWillFail() | Set the nextRequestWillFail flag | Test |
setOptions() | Set the configuration array for the adapter | Test |
setResponse() | Set the HTTP response(s) to be returned by this adapter | Test |
setResponseIndex() | Sets the position of the response buffer. Selects which response will be returned on the next call to read(). | Test |
write() | Send request to the remote server | Test |
Adapter constructor, currently empty. Config is set using setOptions()
Returns:
Add another response to the response buffer.
Parameter Name | Type | Description |
---|---|---|
$response | string|\Response |
Returns:
Close the connection (dummy)
Returns:
Connect to the remote server
Parameter Name | Type | Description |
---|---|---|
$host | string | |
$port | int | |
$secure | bool |
Returns:
Return the response set in $this->setResponse()
Returns: string
Set the nextRequestWillFail flag
Parameter Name | Type | Description |
---|---|---|
$flag | bool |
Returns: \Zend\Http\Client\Adapter\Test
Set the configuration array for the adapter
Parameter Name | Type | Description |
---|---|---|
$options | array|\Traversable |
Returns:
Set the HTTP response(s) to be returned by this adapter
Parameter Name | Type | Description |
---|---|---|
$response | \Zend\Http\Response|array|string |
Returns:
Sets the position of the response buffer. Selects which response will be returned on the next call to read().
Parameter Name | Type | Description |
---|---|---|
$index | int |
Returns:
Send request to the remote server
Parameter Name | Type | Description |
---|---|---|
$method | string | |
$uri | \Zend\Uri\Uri | |
$httpVer | string | |
$headers | array | |
$body | string |
Returns: string Request as string