## 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.

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

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

Variable Summary
array $config
integer $responseIndex
array $responses
boolean $_nextRequestWillFail
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 ([Zend_Config $config = array()])
Zend_Http_Client_Adapter_Test setNextRequestWillFail (boolean $flag)
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 57)

Parameters array

- access: protected

integer $responseIndex = 0 (line 72)

Current position in the response buffer

- access: protected

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

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

- access: protected

boolean $_nextRequestWillFail = false (line 79)

Wether or not the next request will fail with an exception

- access: protected

Methods
Constructor __construct (line 85)

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

- access: public

Zend_Http_Client_Adapter_Test __construct ()
addResponse (line 214)

Add another response to the response buffer.

- access: public

void addResponse (string $response)

- string $response: Zend_Http_Response|$response

close (line 191)

Close the connection (dummy)

- access: public

void close ()

Implementation of:

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

connect (line 133)

Connect to the remote server

- throws: Zend_Http_Client_Adapter_Exception
- 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 179)

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 106)

Set the configuration array for the adapter

- access: public

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

- Zend_Config $config: | array $config

Implementation of:

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

setNextRequestWillFail (line 94)

Set the nextRequestWillFail flag

- access: public

Zend_Http_Client_Adapter_Test setNextRequestWillFail (boolean $flag)

- boolean $flag

setResponse (line 199)

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 229)

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 152)

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 Tue, 26 Oct 2010 20:09:17 +0400 by phpDocumentor 1.4.2