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
array $config = 'array'
Parameters array
integer $responseIndex = '0'
Current position in the response buffer
array $responses = 'array'
Buffer of responses to be returned by the read() method. Can be set using setResponse() and addResponse().
__construct(
)
:
Adapter constructor, currently empty. Config is set using setConfig()
addResponse(
string $response
)
:
Add another response to the response buffer.
close(
)
:
Close the connection (dummy)
connect(
string $host, int $port
=
80, boolean $secure
=
false
)
:
Connect to the remote server
read(
)
:
string
Return the response set in $this->setResponse()
setConfig(
Zend_Config $config
=
array
)
:
Set the configuration array for the adapter
setNextRequestWillFail(
boolean $flag
)
:
Zend_Http_Client_Adapter_Test
Set the nextRequestWillFail flag
setResponse(
Zend_Http_Response|array|string $response
)
:
Set the HTTP response(s) to be returned by this adapter
setResponseIndex(
integer $index
)
:
Sets the position of the response buffer. Selects which response will be returned on the next call to read().
write(
string $method, Zend_Uri_Http $uri, string $http_ver
=
1.1, array $headers
=
array, string $body
)
:
string
Send request to the remote server