PHP Класс RESTContext, imbo

Наследование: implements Behat\Behat\Context\Context
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$client Guzzle\Http\Client Guzzle client used to make requests against the httpd
$queryParams array Query parameters for the request
$requestBody string Optional request body to add to the request
$requestHeaders array Headers for the request
$responses Guzzle\Http\Message\Response[] The current response objects used by the client (populated when the request is sent)

Открытые методы

Метод Описание
__construct ( array $parameters ) Class constructor
appendQueryStringParameter ( $queryParam, $value )
assertEmptyResponseBody ( )
assertEqualResponseHeaders ( Behat\Gherkin\Node\PyStringNode $list )
assertExistingHeaders ( Behat\Gherkin\Node\PyStringNode $list )
assertHeaderDoesNotExist ( $header )
assertHeaderNotSameForPreviousRequests ( $header )
assertMaxAge ( $seconds )
assertMissingHeaders ( Behat\Gherkin\Node\PyStringNode $list )
assertMustRevalidate ( $doesNotHave = false )
assertResponseBody ( $match, Behat\Gherkin\Node\PyStringNode $expected )
assertResponseBodyLength ( $length )
assertResponseHeader ( $header, $match, $value )
assertResponseIsCacheable ( $cacheable = true )
assertResponseStatus ( $status )
attachFileToRequestBody ( $path )
makeSameRequest ( $method )
performRequestWithGivenQueryString ( $path )
request ( $path, $method = 'GET' )
setOverrideMethodHeader ( string $method ) Set method override header used to fake non-standard HTTP verbs
setRequestBody ( Behat\Gherkin\Node\PyStringNode $body )
setRequestHeader ( $header, $value )
setUp ( Behat\Behat\Event\SuiteEvent $event ) Start up the built in httpd in php-5.4
tearDown ( Behat\Behat\Event\SuiteEvent $event ) Collect code coverage after the suite has been run

Защищенные методы

Метод Описание
addHeaderToNextRequest ( string $key, mixed $value ) Add a request header for the next request
getLastResponse ( ) : Guzzle\Http\Message\Response Get the response to the last request made by the Guzzle client
getPreviousCacheControlHeader ( ) : Guzzle\Http\Message\Header\CacheControl Get the cache-control header for the previous response

Приватные методы

Метод Описание
canConnectToHttpd ( string $host, integer $port ) : boolean See if we have an httpd we can connect to
createClient ( ) Create a new HTTP client
getOverrideVerbs ( ) Returns a list of HTTP verbs that we need to do an override of in order to bypass limitations in the built-in PHP HTTP server.
startBuiltInHttpd ( string $host, integer $port, string $documentRoot, string $router, string $httpdLog ) : integer Start the built in httpd in php-5.4

Описание методов

__construct() публичный Метод

Class constructor
public __construct ( array $parameters )
$parameters array Context parameters

addHeaderToNextRequest() защищенный Метод

Add a request header for the next request
protected addHeaderToNextRequest ( string $key, mixed $value )
$key string The name of the header
$value mixed The value of the header

appendQueryStringParameter() публичный Метод

public appendQueryStringParameter ( $queryParam, $value )

assertEmptyResponseBody() публичный Метод

assertEqualResponseHeaders() публичный Метод

public assertEqualResponseHeaders ( Behat\Gherkin\Node\PyStringNode $list )
$list Behat\Gherkin\Node\PyStringNode

assertExistingHeaders() публичный Метод

public assertExistingHeaders ( Behat\Gherkin\Node\PyStringNode $list )
$list Behat\Gherkin\Node\PyStringNode

assertHeaderDoesNotExist() публичный Метод

public assertHeaderDoesNotExist ( $header )

assertHeaderNotSameForPreviousRequests() публичный Метод

assertMaxAge() публичный Метод

public assertMaxAge ( $seconds )

assertMissingHeaders() публичный Метод

public assertMissingHeaders ( Behat\Gherkin\Node\PyStringNode $list )
$list Behat\Gherkin\Node\PyStringNode

assertMustRevalidate() публичный Метод

public assertMustRevalidate ( $doesNotHave = false )

assertResponseBody() публичный Метод

public assertResponseBody ( $match, Behat\Gherkin\Node\PyStringNode $expected )
$expected Behat\Gherkin\Node\PyStringNode

assertResponseBodyLength() публичный Метод

public assertResponseBodyLength ( $length )

assertResponseHeader() публичный Метод

public assertResponseHeader ( $header, $match, $value )

assertResponseIsCacheable() публичный Метод

public assertResponseIsCacheable ( $cacheable = true )

assertResponseStatus() публичный Метод

public assertResponseStatus ( $status )

attachFileToRequestBody() публичный Метод

public attachFileToRequestBody ( $path )

getLastResponse() защищенный Метод

Get the response to the last request made by the Guzzle client
protected getLastResponse ( ) : Guzzle\Http\Message\Response
Результат Guzzle\Http\Message\Response

getPreviousCacheControlHeader() защищенный Метод

Get the cache-control header for the previous response
protected getPreviousCacheControlHeader ( ) : Guzzle\Http\Message\Header\CacheControl
Результат Guzzle\Http\Message\Header\CacheControl The Cache-Control header for the previous response

makeSameRequest() публичный Метод

public makeSameRequest ( $method )

performRequestWithGivenQueryString() публичный Метод

request() публичный Метод

public request ( $path, $method = 'GET' )

setOverrideMethodHeader() публичный Метод

Set method override header used to fake non-standard HTTP verbs
public setOverrideMethodHeader ( string $method )
$method string Override method

setRequestBody() публичный Метод

public setRequestBody ( Behat\Gherkin\Node\PyStringNode $body )
$body Behat\Gherkin\Node\PyStringNode

setRequestHeader() публичный Метод

public setRequestHeader ( $header, $value )

setUp() публичный статический Метод

Start up the built in httpd in php-5.4
public static setUp ( Behat\Behat\Event\SuiteEvent $event )
$event Behat\Behat\Event\SuiteEvent

tearDown() публичный статический Метод

Collect code coverage after the suite has been run
public static tearDown ( Behat\Behat\Event\SuiteEvent $event )
$event Behat\Behat\Event\SuiteEvent

Описание свойств

$client защищенное свойство

Guzzle client used to make requests against the httpd
protected Client,Guzzle\Http $client
Результат Guzzle\Http\Client

$queryParams защищенное свойство

Query parameters for the request
protected array $queryParams
Результат array

$requestBody защищенное свойство

Optional request body to add to the request
protected string $requestBody
Результат string

$requestHeaders защищенное свойство

Headers for the request
protected array $requestHeaders
Результат array

$responses защищенное свойство

The current response objects used by the client (populated when the request is sent)
protected Response[],Guzzle\Http\Message $responses
Результат Guzzle\Http\Message\Response[]