PHP Class Horde_Http_Request_Mock, horde

Author: Chuck Hagenbuch ([email protected])
Author: Gunnar Wrobel ([email protected])
Inheritance: extends Horde_Http_Request_Base
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_responses array Mock responses to return.

Public Methods

Method Description
addResponse ( string | resourse $body, string $code = 200, string $uri = '', array $headers = [] ) : Horde_Http_Response_Mock Adds a response to the stack of responses.
addResponses ( array $responses ) : null Set the HTTP response(s) to be returned by this adapter as an array of strings.
send ( ) : Horde_Http_Response_Mock | null Send this HTTP request
setResponse ( Horde_Http_Response_Base $response ) Set the HTTP response(s) to be returned by this adapter. This overwrites any responses set before.

Method Details

addResponse() public method

Adds a response to the stack of responses.
public addResponse ( string | resourse $body, string $code = 200, string $uri = '', array $headers = [] ) : Horde_Http_Response_Mock
$body string | resourse The response body content.
$code string The response code.
$uri string The request uri.
$headers array Response headers. This can be one string representing the whole header or an array of strings with one string per header line.
return Horde_Http_Response_Mock The response.

addResponses() public method

Set the HTTP response(s) to be returned by this adapter as an array of strings.
public addResponses ( array $responses ) : null
$responses array The responses to be added to the stack.
return null

send() public method

Send this HTTP request
public send ( ) : Horde_Http_Response_Mock | null
return Horde_Http_Response_Mock | null A response object or NULL in case no responses has been set.

setResponse() public method

Set the HTTP response(s) to be returned by this adapter. This overwrites any responses set before.
public setResponse ( Horde_Http_Response_Base $response )
$response Horde_Http_Response_Base

Property Details

$_responses protected property

Mock responses to return.
protected array $_responses
return array