Interface

eZ\Bundle\EzPublishRestBundle\Features\Context\RestClient\DriverInterface

interface DriverInterface

DriverInterface has the definition of the methods needed for our REST tests so Drivers need to implement this interface for a seamless interaction.

Notice: Setters are for request and Getters for response since no assertion is done on requests, and no set is done onto responses

Constants

AUTH_TYPE_BASIC

authentication types.

Methods

send()

Send the request.

setHost(string $host)

Set request host.

setResource(string $resource)

Set request resource url.

setMethod(string $method)

Set request method.

string getStatusCode()

Get response status code.

string getStatusMessage()

Get response status message.

string getHeader(string $header)

Get response header.

setHeader($header, $value)

Set request header.

array getHeaders()

Get all response headers.

setHeaders(array $headers)

Set request headers.

string getBody()

Get response body.

setBody(string $body)

Set request body.

setAuthentication(string $user, string $password, string $type = self::AUTH_TYPE_BASIC)

Set authentication.

Details

at line 28
public send()

Send the request.

at line 35
public setHost(string $host)

Set request host.

Parameters

string $host

at line 42
public setResource(string $resource)

Set request resource url.

Parameters

string $resource

at line 49
public setMethod(string $method)

Set request method.

Parameters

string $method Can be GET, POST, PATCH, ...

at line 58
public string getStatusCode()

Get response status code.

Return Value

string

Exceptions

RuntimeException If request hasn't been send already

at line 67
public string getStatusMessage()

Get response status message.

Return Value

string

Exceptions

RuntimeException If request hasn't been send already

at line 78
public string getHeader(string $header)

Get response header.

Parameters

string $header Header to fetch

Return Value

string Header value, or a list if its more than one

Exceptions

RuntimeException If request hasn't been send already

at line 85
public setHeader($header, $value)

Set request header.

Parameters

$header
$value

at line 94
public array getHeaders()

Get all response headers.

Return Value

array Associative array with $header => $value (value can be an array if it hasn't a single value)

Exceptions

RuntimeException If request hasn't been send already

at line 101
public setHeaders(array $headers)

Set request headers.

Parameters

array $headers Associative array with $header => $value (value can be an array if it hasn't a single value)

at line 110
public string getBody()

Get response body.

Return Value

string

Exceptions

RuntimeException If request hasn't been send already

at line 117
public setBody(string $body)

Set request body.

Parameters

string $body

at line 126
public setAuthentication(string $user, string $password, string $type = self::AUTH_TYPE_BASIC)

Set authentication.

Parameters

string $user
string $password
string $type Authentication type