Horde_Http_Request_Mock
extends Horde_Http_Request_Base
in package
Mock HTTP request object.
Tags
Table of Contents
- $authenticationScheme : string
- $data : array<string|int, mixed>|string
- $headers : array<string|int, mixed>
- $method : string
- $password : string
- $proxyAuthenticationScheme : string
- $proxyPassword : string
- $proxyPort : int
- $proxyServer : string
- $proxyType : int
- $proxyUsername : string
- $redirects : int
- $timeout : int
- $uri : string|Horde_Url
- $userAgent : string
- $username : string
- $verifyPeer : bool
- $_headers : array<string|int, mixed>
- Request headers
- $_options : array<string|int, mixed>
- $_responses : array<string|int, mixed>
- Mock responses to return.
- __construct() : mixed
- Constructor
- __get() : mixed
- Get an adapter parameter
- __set() : mixed
- Set a request parameter
- addResponse() : Horde_Http_Response_Mock
- Adds a response to the stack of responses.
- addResponses() : null
- Set the HTTP response(s) to be returned by this adapter as an array of strings.
- getDefaultOptions() : mixed
- getHeader() : string
- Get the current value of $header
- send() : Horde_Http_Response_Mock|null
- Send this HTTP request
- setHeaders() : mixed
- Set one or more headers
- setOptions() : mixed
- setResponse() : mixed
- Set the HTTP response(s) to be returned by this adapter. This overwrites any responses set before.
Properties
$authenticationScheme
public
string
$authenticationScheme
Authentication method, one of the Horde_Http::AUTH_* constants.
$data
public
array<string|int, mixed>|string
$data
POST data fields or POST/PUT data body.
$headers
public
array<string|int, mixed>
$headers
Hash with additional request headers.
$method
public
string
$method
Default request method if not specified for individual requests.
$password
public
string
$password
Authentication password.
$proxyAuthenticationScheme
public
string
$proxyAuthenticationScheme
Proxy authentication method, one of the Horde_Http::AUTH_* constants.
$proxyPassword
public
string
$proxyPassword
Proxy authentication password.
$proxyPort
public
int
$proxyPort
Port number of a proxy server.
$proxyServer
public
string
$proxyServer
Host name of a proxy server.
$proxyType
public
int
$proxyType
Proxy server type, one of the Horde_Http::PROXY_* constants.
$proxyUsername
public
string
$proxyUsername
Proxy authentication user name.
$redirects
public
int
$redirects
Maximum number of redirects to follow.
$timeout
public
int
$timeout
Timeout in seconds.
$uri
public
string|Horde_Url
$uri
Default URI if not specified for individual requests.
$userAgent
public
string
$userAgent
User-Agent: request header contents.
$username
public
string
$username
Authentication user name.
$verifyPeer
public
bool
$verifyPeer
Verify SSL peer certificates?
$_headers
Request headers
protected
array<string|int, mixed>
$_headers
= array()
$_options
protected
array<string|int, mixed>
$_options
= array()
$_responses
Mock responses to return.
protected
array<string|int, mixed>
$_responses
= array()
Methods
__construct()
Constructor
public
__construct([mixed $options = array() ]) : mixed
Parameters
- $options : mixed = array()
Return values
mixed —__get()
Get an adapter parameter
public
__get(string $name) : mixed
Parameters
- $name : string
-
The parameter to get.
Return values
mixed —Parameter value.
__set()
Set a request parameter
public
__set(string $name, mixed $value) : mixed
Parameters
- $name : string
-
The parameter to set.
- $value : mixed
-
Parameter value.
Return values
mixed —addResponse()
Adds a response to the stack of responses.
public
addResponse(string|resourse $body[, string $code = 200 ][, string $uri = '' ][, array<string|int, mixed> $headers = array() ]) : Horde_Http_Response_Mock
Parameters
- $body : string|resourse
-
The response body content.
- $code : string = 200
-
The response code.
- $uri : string = ''
-
The request uri.
- $headers : array<string|int, mixed> = array()
-
Response headers. This can be one string representing the whole header or an array of strings with one string per header line.
Return values
Horde_Http_Response_Mock —The response.
addResponses()
Set the HTTP response(s) to be returned by this adapter as an array of strings.
public
addResponses(array<string|int, mixed> $responses) : null
Parameters
- $responses : array<string|int, mixed>
-
The responses to be added to the stack.
Return values
null —getDefaultOptions()
public
getDefaultOptions() : mixed
Return values
mixed —getHeader()
Get the current value of $header
public
getHeader(string $header) : string
Parameters
- $header : string
-
Header name to get
Return values
string —$header's current value
send()
Send this HTTP request
public
send() : Horde_Http_Response_Mock|null
Return values
Horde_Http_Response_Mock|null —A response object or NULL in case no responses has been set.
setHeaders()
Set one or more headers
public
setHeaders(mixed $headers[, string $value = null ]) : mixed
Parameters
- $headers : mixed
-
A hash of header + value pairs, or a single header name
- $value : string = null
-
A header value
Return values
mixed —setOptions()
public
setOptions([mixed $options = array() ]) : mixed
Parameters
- $options : mixed = array()
Return values
mixed —setResponse()
Set the HTTP response(s) to be returned by this adapter. This overwrites any responses set before.
public
setResponse(Horde_Http_Response_Base $response) : mixed
Parameters
- $response : Horde_Http_Response_Base