XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
HTTP_Request2_Adapter_Mock Class Reference
Inheritance diagram for HTTP_Request2_Adapter_Mock:
HTTP_Request2_Adapter

Public Member Functions

 sendRequest (HTTP_Request2 $request)
 
 addResponse ($response, $url=null)
 
- Public Member Functions inherited from HTTP_Request2_Adapter
 sendRequest (HTTP_Request2 $request)
 

Static Public Member Functions

static createResponseFromString ($str)
 
static createResponseFromFile ($fp)
 

Protected Attributes

 $responses = array()
 
- Protected Attributes inherited from HTTP_Request2_Adapter
 $request
 
 $requestBody
 
 $contentLength
 

Additional Inherited Members

- Protected Member Functions inherited from HTTP_Request2_Adapter
 calculateRequestLength (&$headers)
 
- Static Protected Attributes inherited from HTTP_Request2_Adapter
static $bodyDisallowed = array('TRACE')
 
static $bodyRequired = array('POST', 'PUT')
 

Detailed Description

Definition at line 50 of file Mock.php.

Member Function Documentation

HTTP_Request2_Adapter_Mock::addResponse (   $response,
  $url = null 
)

Adds response to the queue

Parameters
mixed$responseeither a string, a pointer to an open file, an instance of HTTP_Request2_Response or Exception
string$urlA request URL this response should be valid for (see http://pear.php.net/bugs/bug.php?id=19276)
Exceptions
HTTP_Request2_Exception

Definition at line 107 of file Mock.php.

static HTTP_Request2_Adapter_Mock::createResponseFromFile (   $fp)
static

Creates a new HTTP_Request2_Response object from a file

Parameters
resource$fpfile pointer returned by fopen()
Returns
HTTP_Request2_Response
Exceptions
HTTP_Request2_Exception

Definition at line 152 of file Mock.php.

static HTTP_Request2_Adapter_Mock::createResponseFromString (   $str)
static

Creates a new HTTP_Request2_Response object from a string

Parameters
string$strstring containing HTTP response message
Returns
HTTP_Request2_Response
Exceptions
HTTP_Request2_Exception

Definition at line 129 of file Mock.php.

HTTP_Request2_Adapter_Mock::sendRequest ( HTTP_Request2  $request)

Returns the next response from the queue built by addResponse()

Only responses without explicit URLs or with URLs equal to request URL will be considered. If matching response is not found or the queue is empty then default empty response with status 400 will be returned, if an Exception object was added to the queue it will be thrown.

Parameters
HTTP_Request2$requestHTTP request message
Returns
HTTP_Request2_Response
Exceptions
Exception

Definition at line 71 of file Mock.php.

Member Data Documentation

HTTP_Request2_Adapter_Mock::$responses = array()
protected

Definition at line 56 of file Mock.php.


The documentation for this class was generated from the following file: