API Documentation

Http/Client/Adapter/Test.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Http
subpackage
Client_Adapter
version
$Id: Test.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Http_Client_Adapter_Test

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Http_Client_Adapter_Test

Implements
Zend_Http_Client_Adapter_Interface
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Http
subpackage
Client_Adapter
Properties
$config
$responses
$responseIndex
$_nextRequestWillFail
Methods
__construct
setNextRequestWillFail
setConfig
connect
write
read
close
setResponse
addResponse
setResponseIndex

Description

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.

Properties

$_nextRequestWillFail

boolean $_nextRequestWillFail = 'false'

Wether or not the next request will fail with an exception

Details

$_nextRequestWillFail
boolean
visibility
protected
default
false
final
false
static
false

$config

array $config = 'array'

Parameters array

Details

$config
array
visibility
protected
default
array
final
false
static
false

$responseIndex

integer $responseIndex = '0'

Current position in the response buffer

Details

$responseIndex
integer
visibility
protected
default
0
final
false
static
false

$responses

array $responses = 'array'

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

Details

$responses
array
visibility
protected
default
array
final
false
static
false

Methods

__construct

__construct( ) :

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

Details
visibility
public
final
false
static
false

addResponse

addResponse( string $response ) :

Add another response to the response buffer.

Arguments
$response
string
Zend_Http_Response|$response
Details
visibility
public
final
false
static
false

close

close( ) :

Close the connection (dummy)

Details
visibility
public
final
false
static
false

connect

connect( string $host, int $port = 80, boolean $secure = false ) :

Connect to the remote server

Arguments
$host
string
$port
int
$secure
boolean
Details
visibility
public
final
false
static
false
throws

read

read( ) : string

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

Output
string
Details
visibility
public
final
false
static
false

setConfig

setConfig( Zend_Config $config = array ) :

Set the configuration array for the adapter

Arguments
$config
Zend_Config
| array $config
Details
visibility
public
final
false
static
false

setNextRequestWillFail

setNextRequestWillFail( boolean $flag ) : Zend_Http_Client_Adapter_Test

Set the nextRequestWillFail flag

Arguments
$flag
boolean
Details
visibility
public
final
false
static
false

setResponse

setResponse( Zend_Http_Response|array|string $response ) :

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

Arguments
$response
Zend_Http_Responsearraystring
Details
visibility
public
final
false
static
false

setResponseIndex

setResponseIndex( integer $index ) :

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

Arguments
$index
integer
Details
visibility
public
final
false
static
false

write

write( string $method, Zend_Uri_Http $uri, string $http_ver = 1.1, array $headers = array, string $body ) : string

Send request to the remote server

Arguments
$method
string
$uri
Zend_Uri_Http
$http_ver
string
$headers
array
$body
string
Output
string
Request as string
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.