## Zend_Http_Client_Adapter_Test

Description

Implements interfaces:

- Zend_Http_Client_Adapter_Interface

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.

- license: New BSD License
- copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Http/Client/Adapter/Test.php (line 41)

Variable Summary
array $config
integer $responseIndex
array $responses
Method Summary
Zend_Http_Client_Adapter_Test __construct ()
void addResponse (string $response)
void close ()
void connect (string $host, [int $port = 80], [boolean $secure = false], int $timeout)
string read ()
void setConfig ([array $config = array()])
void setResponse (Zend_Http_Response|array|string $response)
void setResponseIndex (integer $index)
string write (string $method, Zend_Uri_Http $uri, [string $http_ver = '1.1'], [array $headers = array()], [string $body = ''])
Variables
array $config = array() (line 48)

Parameters array

- access: protected

integer $responseIndex = 0 (line 63)

Current position in the response buffer

- access: protected

array $responses = array("HTTP/1.1 400 Bad Request\r\n\r\n") (line 56)

Buffer of responses to be returned by the read() method. Can be set using setResponse() and addResponse().

- access: protected

Methods
Constructor __construct (line 69)

Adapter constructor, currently empty. Config is set using setConfig()

- access: public

Zend_Http_Client_Adapter_Test __construct ()
addResponse (line 171)

Add another response to the response buffer.

- access: public

void addResponse (string $response)

- string $response

close (line 148)

Close the connection (dummy)

- access: public

void close ()

Implementation of:

Zend_Http_Client_Adapter_Interface::close()
  Close the connection to the server

connect (line 96)

Connect to the remote server

- access: public

void connect (string $host, [int $port = 80], [boolean $secure = false], int $timeout)

- string $host
- int $port
- boolean $secure
- int $timeout

Implementation of:

Zend_Http_Client_Adapter_Interface::connect()
  Connect to the remote server

read (line 136)

Return the response set in $this->setResponse()

- access: public

string read ()

Implementation of:

Zend_Http_Client_Adapter_Interface::read()
  Read response from server

setConfig (line 77)

Set the configuration array for the adapter

- access: public

void setConfig ([array $config = array()])

- array $config

Implementation of:

Zend_Http_Client_Adapter_Interface::setConfig()
  Set the configuration array for the adapter

setResponse (line 156)

Set the HTTP response(s) to be returned by this adapter

- access: public

void setResponse (Zend_Http_Response|array|string $response)

- Zend_Http_Response|array|string $response

setResponseIndex (line 182)

Sets the position of the response buffer. Selects which response will be returned on the next call to read().

- access: public

void setResponseIndex (integer $index)

- integer $index

write (line 109)

Send request to the remote server

- return: Request as string
- access: public

string write (string $method, Zend_Uri_Http $uri, [string $http_ver = '1.1'], [array $headers = array()], [string $body = ''])

- string $method
- Zend_Uri_Http $uri
- string $http_ver
- array $headers
- string $body

Implementation of:

Zend_Http_Client_Adapter_Interface::write()
  Send request to the remote server

Documentation generated on Wed, 21 Feb 2007 12:00:57 -0800 by phpDocumentor 1.3.1