Http/Client/Adapter/Test.php
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.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Http
- Subpackage
- Client_Adapter
- Version
- $Id$
\Zend_Http_Client_Adapter_Test
Package: Zend_Http\Client_Adapter







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.
- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

boolean $_nextRequestWillFail = falseWether or not the next request will fail with an exception
Default value
falseDetails- Type
- boolean
Methods

addResponse( $response) : voidAdd another response to the response buffer.
Parameters
| Name | Type | Description |
|---|---|---|
| $response |

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

setConfig( $config = array()) : voidSet the configuration array for the adapter
Parameters
| Name | Type | Description |
|---|---|---|
| $config |

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

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

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

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