Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
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.

boolean
$_nextRequestWillFail= 'false'
Wether or not the next request will fail with an exception
false
Details
integer
$responseIndex= '0'
Current position in the response buffer
0
Details
addResponse(
string $response
)
:
void
Add another response to the response buffer.
Name | Type | Description |
---|---|---|
$response | string | Zend_Http_Response|$response |

connect(
string $host, int $port
=
80, boolean $secure
=
false
)
:
void
Connect to the remote server
Name | Type | Description |
---|---|---|
$host | string | |
$port | int | |
$secure | boolean |
Exception | Description |
---|---|
\Zend_Http_Client_Adapter_Exception |

setConfig(
\Zend_Config $config
=
array()
)
:
void
Set the configuration array for the adapter
Name | Type | Description |
---|---|---|
$config | \Zend_Config | | array $config |

setNextRequestWillFail(
boolean $flag
)
:
\Zend_Http_Client_Adapter_Test
Set the nextRequestWillFail flag
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Http_Client_Adapter_Test |

setResponse(
\Zend_Http_Response|array|string $response
)
:
void
Set the HTTP response(s) to be returned by this adapter
Name | Type | Description |
---|---|---|
$response | \Zend_Http_Response|array|string |

setResponseIndex(
integer $index
)
:
void
Sets the position of the response buffer. Selects which response will be returned on the next call to read().
Name | Type | Description |
---|---|---|
$index | integer |

write(
string $method, \Zend_Uri_Http $uri, string $http_ver
=
'1.1', array $headers
=
array(), string $body
=
''
)
:
string
Send request to the remote server
Name | Type | Description |
---|---|---|
$method | string | |
$uri | \Zend_Uri_Http | |
$http_ver | string | |
$headers | array | |
$body | string |
Type | Description |
---|---|
string | Request as string |