63. Class

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

63.1.1. Methods

63.1.1.1. __construct

__construct()

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

63.1.1.2. setNextRequestWillFail

setNextRequestWillFail()

Set the nextRequestWillFail flag

Parameters:bool
Return type:ZendHttpClientAdapterTest

63.1.1.3. setOptions

setOptions()

Set the configuration array for the adapter

Parameters:array|Traversable
Throws ExceptionInvalidArgumentException:
 

63.1.1.4. connect

connect()

Connect to the remote server

Parameters:
  • string
  • int
  • bool
  • int
Throws ExceptionRuntimeException:
 

63.1.1.5. write

write()

Send request to the remote server

Parameters:
  • string
  • ZendUriUri
  • string
  • array
  • string
Return type:

string Request as string

63.1.1.6. read

read()

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

Return type:string

63.1.1.7. close

close()

Close the connection (dummy)

63.1.1.8. setResponse

setResponse()

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

Parameters:ZendHttpResponse|array|string

63.1.1.9. addResponse

addResponse()

Add another response to the response buffer.

Parameters:string|Response

63.1.1.10. setResponseIndex

setResponseIndex()

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

Parameters:integer
Throws ExceptionOutOfRangeException: