PHP Class RestContext

Inheritance: extends Behat\Behat\Context\BehatContext
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Свойство Type Description
$access_token string Client access_token
$associative boolean Specifies if the response data should be an associative array or a nested stdClass object hierarchy.
$client Buzz\Browser
$collectedData string Data collected from steps
$headers array Headers
$locations array Locations collected from steps
$requestMethod string
$requestUrl string Used for debugging purpose only.
$response Buzz\Message\Response
$responseData mixed Data decoded from HTTP response.
$responseDecodeException Exception
$responseIsJson boolean

Méthodes publiques

Méthode Description
__construct ( array $parameters ) Initializes context.
authenitcatedAsWithClient ( string $username, string $password, string $client, $secret ) : void
authenitcatedWith ( $client, $secret ) : void
checkItemsOrder ( string $order ) : void
collectData ( $dataKey, Behat\Gherkin\Node\TableNode $data ) : void
collectFakeData ( string $dataKey, Behat\Gherkin\Node\TableNode $data ) : boolean
collectHeaders ( $key, $value ) : void
collectLocations ( $locationIndex ) : boolean
echoLastResponse ( ) : void
fieldIsOfTypeWithValue ( string $fieldName, string $type, string $fieldValue ) : void
getResponse ( ) : Guzzle\Http\Message\Response Return the response object.
getResponseData ( ) : mixed Return the response data.
iRequest ( string $pageUrl ) : void
iSubmitDataTo ( $dataKey, string $pageUrl ) : void
processPageUrl ( $pageUrl )
processResponse ( Buzz\Message\Response $response = null, boolean $asJson = true ) : void This public method is also for other context(s) to process REST API call and inject response into this context.
saveFieldValueUnderLocation ( string $fieldName, string $locationIndex ) : Behat\Behat\Context\Step\Then | void
thatIWantToDelete ( ) : void
thatIWantToFind ( ) : void
thatIWantToLink ( ) : void
thatIWantToMakeANew ( ) : void
thatIWantToUnlink ( ) : void
thatIWantToUpdate ( ) : void
theResponseHasAField ( string $name ) : void
theResponseIsJson ( string $notJson = '' ) : void
theResponseShouldBe ( string $string ) : void
theResponseShouldContain ( string $str ) : void
theResponseShouldNotHaveAField ( string $name ) : void
theResponseStatusCodeShouldBe ( integer $httpStatus ) : void
valueOfTheFieldEquals ( string $fieldName, string $fieldValue ) : void

Méthodes protégées

Méthode Description
decodeJson ( string $string ) : mixed Decode JSON string.
processResponseBody ( string $jsonData, boolean $asJson = true ) : void Process response body. This method may also be used by other context(s) to process REST API call and inject response body into this context by using 2nd parameter $asJson.

Private Methods

Méthode Description
extractValueByGivenLocation ( $fieldValue )

Method Details

__construct() public méthode

Every scenario gets it's own context object.
public __construct ( array $parameters )
$parameters array Context parameters (set them up through behat.yml)

authenitcatedAsWithClient() public méthode

public authenitcatedAsWithClient ( string $username, string $password, string $client, $secret ) : void
$username string
$password string
$client string
Résultat void

authenitcatedWith() public méthode

public authenitcatedWith ( $client, $secret ) : void
Résultat void

checkItemsOrder() public méthode

public checkItemsOrder ( string $order ) : void
$order string
Résultat void

collectData() public méthode

public collectData ( $dataKey, Behat\Gherkin\Node\TableNode $data ) : void
$data Behat\Gherkin\Node\TableNode
Résultat void

collectFakeData() public méthode

public collectFakeData ( string $dataKey, Behat\Gherkin\Node\TableNode $data ) : boolean
$dataKey string
$data Behat\Gherkin\Node\TableNode
Résultat boolean

collectHeaders() public méthode

public collectHeaders ( $key, $value ) : void
Résultat void

collectLocations() public méthode

public collectLocations ( $locationIndex ) : boolean
Résultat boolean

decodeJson() protected méthode

Decode JSON string.
See also: http://www.php.net/json_last_error
protected decodeJson ( string $string ) : mixed
$string string A JSON string.
Résultat mixed

echoLastResponse() public méthode

public echoLastResponse ( ) : void
Résultat void

fieldIsOfTypeWithValue() public méthode

public fieldIsOfTypeWithValue ( string $fieldName, string $type, string $fieldValue ) : void
$fieldName string
$type string
$fieldValue string
Résultat void

getResponse() public méthode

This public method is also for other context(s) to get and process REST API response.
public getResponse ( ) : Guzzle\Http\Message\Response
Résultat Guzzle\Http\Message\Response

getResponseData() public méthode

This public method is also for other context(s) to get and process REST API response.
public getResponseData ( ) : mixed
Résultat mixed

iRequest() public méthode

public iRequest ( string $pageUrl ) : void
$pageUrl string
Résultat void

iSubmitDataTo() public méthode

public iSubmitDataTo ( $dataKey, string $pageUrl ) : void
$pageUrl string
Résultat void

processPageUrl() public méthode

public processPageUrl ( $pageUrl )

processResponse() public méthode

This public method is also for other context(s) to process REST API call and inject response into this context.
public processResponse ( Buzz\Message\Response $response = null, boolean $asJson = true ) : void
$response Buzz\Message\Response
$asJson boolean Process the response as JSON or not.
Résultat void

processResponseBody() protected méthode

Process response body. This method may also be used by other context(s) to process REST API call and inject response body into this context by using 2nd parameter $asJson.
protected processResponseBody ( string $jsonData, boolean $asJson = true ) : void
$jsonData string
$asJson boolean
Résultat void

saveFieldValueUnderLocation() public méthode

public saveFieldValueUnderLocation ( string $fieldName, string $locationIndex ) : Behat\Behat\Context\Step\Then | void
$fieldName string
$locationIndex string
Résultat Behat\Behat\Context\Step\Then | void

thatIWantToDelete() public méthode

public thatIWantToDelete ( ) : void
Résultat void

thatIWantToFind() public méthode

public thatIWantToFind ( ) : void
Résultat void

thatIWantToMakeANew() public méthode

public thatIWantToMakeANew ( ) : void
Résultat void

thatIWantToUpdate() public méthode

public thatIWantToUpdate ( ) : void
Résultat void

theResponseHasAField() public méthode

public theResponseHasAField ( string $name ) : void
$name string
Résultat void

theResponseIsJson() public méthode

public theResponseIsJson ( string $notJson = '' ) : void
$notJson string
Résultat void

theResponseShouldBe() public méthode

public theResponseShouldBe ( string $string ) : void
$string string
Résultat void

theResponseShouldContain() public méthode

public theResponseShouldContain ( string $str ) : void
$str string
Résultat void

theResponseShouldNotHaveAField() public méthode

public theResponseShouldNotHaveAField ( string $name ) : void
$name string
Résultat void

theResponseStatusCodeShouldBe() public méthode

public theResponseStatusCodeShouldBe ( integer $httpStatus ) : void
$httpStatus integer
Résultat void

valueOfTheFieldEquals() public méthode

public valueOfTheFieldEquals ( string $fieldName, string $fieldValue ) : void
$fieldName string
$fieldValue string
Résultat void

Property Details

$access_token protected_oe property

Client access_token
protected string $access_token
Résultat string

$associative protected_oe property

Specifies if the response data should be an associative array or a nested stdClass object hierarchy.
protected bool $associative
Résultat boolean

$client protected_oe property

protected Browser,Buzz $client
Résultat Buzz\Browser

$collectedData protected_oe property

Data collected from steps
protected string $collectedData
Résultat string

$headers protected_oe property

Headers
protected array $headers
Résultat array

$locations protected_oe property

Locations collected from steps
protected array $locations
Résultat array

$requestMethod protected_oe property

protected string $requestMethod
Résultat string

$requestUrl protected_oe property

Used for debugging purpose only.
protected string $requestUrl
Résultat string

$response protected_oe property

protected Response,Buzz\Message $response
Résultat Buzz\Message\Response

$responseData protected_oe property

Data decoded from HTTP response.
protected mixed $responseData
Résultat mixed

$responseDecodeException protected_oe property

protected Exception $responseDecodeException
Résultat Exception

$responseIsJson protected_oe property

protected bool $responseIsJson
Résultat boolean