\Zend_Http_Client_Adapter_Test
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.
- Copyright: Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- License: http://framework.zend.com/license/new-bsd New BSD License
Synopsis
class Zend_Http_Client_Adapter_Test
implements
Zend_Http_Client_Adapter_Interface
{
- // members
- protected array $config = ;
- protected array $responses = ;
- protected integer $responseIndex = 0;
- // methods
- public void __construct()
- public void setConfig()
- public void connect()
- public string write()
- public string read()
- public void close()
- public void setResponse()
- public void addResponse()
- public void setResponseIndex()
Hierarchy
Implements
Members
protected
- $config
—
array
Parameters array - $responseIndex
—
integer
Current position in the response buffer - $responses
—
array
Buffer of responses to be returned by the read() method. Can be set using setResponse() and addResponse().
Methods
public
- __construct() — Adapter constructor, currently empty. Config is set using setConfig()
- addResponse() — Add another response to the response buffer.
- close() — Close the connection (dummy)
- connect() — Connect to the remote server
- read() — Return the response set in $this->setResponse()
- setConfig() — Set the configuration array for the adapter
- setResponse() — Set the HTTP response(s) to be returned by this adapter
- setResponseIndex() — Sets the position of the response buffer. Selects which response will be returned on the next call to read().
- write() — Send request to the remote server