PHP Trait eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\EzRest

Datei anzeigen Open project: ezsystems/ezpublish-kernel

Public Properties

Property Type Description
$requestObject eZ\Publish\API\Repository\Values\ValueObject Since there is a need to prepare an object in several steps it needs to be hold until sent to the request body.
$responseObject eZ\Publish\API\Repository\Values\ValueObject | Exception Same idea as the $requestObject, since we need to verify it step by step it need to be stored (as object) for testing.

Public Methods

Method Description
assertHeaderHasObject ( $header, $object )
assertObjectFieldHasValue ( $field, $value )
assertResponseErrorDescription ( $errorDescriptionRegEx )
assertResponseErrorStatusCode ( $code )
assertResponseObject ( string $object )
convertResponseBodyToObject ( string $responseBody, string $contentTypeHeader ) : eZ\Publish\API\Repository\Values\ValueObject Convert the body/content of a response into an object.
getRequestObject ( ) : eZ\Publish\API\Repository\Values\ValueObject Get the request object.
getResponseObject ( ) : eZ\Publish\API\Repository\Values\ValueObject Get the response object (if it's not converted do the conversion also).
iSetTheContentTypeHeaderToInVersion ( $contentType, $version )
makeObject ( $type )
setFieldToEmptyArray ( $field )
setFieldToValue ( $field, $value )
setHeaderWithObject ( $header, $object )

Protected Methods

Method Description
addObjectToRequestBody ( eZ\Publish\API\Repository\Values\ValueObject $object, string $type ) Convert an object and add it to the body/content of the request.
convertObjectTo ( eZ\Publish\API\Repository\Values\ValueObject $object, string $type ) : Response Convert an object to a request.
createRequestObject ( string $objectType ) Create an object of the specified type.
decomposeObjectHeader ( $header ) : false | string Decompose the header to get only the object type of the accept/conten-type headers.
getResponseError ( string $property ) : integer | mixed | string Get property from the returned Exception.
makeObjectHeader ( $object ) Make content-type/accept header with prefix and type.
setRestBodyType ( string $type ) Set body type of requests and responses.

Method Details

addObjectToRequestBody() protected method

Convert an object and add it to the body/content of the request.
protected addObjectToRequestBody ( eZ\Publish\API\Repository\Values\ValueObject $object, string $type )
$object eZ\Publish\API\Repository\Values\ValueObject Object to be converted
$type string Type for the body of the request (XML, JSON)

assertHeaderHasObject() public method

public assertHeaderHasObject ( $header, $object )

assertObjectFieldHasValue() public method

public assertObjectFieldHasValue ( $field, $value )

assertResponseErrorDescription() public method

public assertResponseErrorDescription ( $errorDescriptionRegEx )

assertResponseErrorStatusCode() public method

assertResponseObject() public method

public assertResponseObject ( string $object )
$object string Object should be the object name with namespace

convertObjectTo() protected method

Convert an object to a request.
protected convertObjectTo ( eZ\Publish\API\Repository\Values\ValueObject $object, string $type ) : Response
$object eZ\Publish\API\Repository\Values\ValueObject Object to be converted
$type string Type for conversion
return Symfony\Component\HttpFoundation\Response

convertResponseBodyToObject() public method

Convert the body/content of a response into an object.
public convertResponseBodyToObject ( string $responseBody, string $contentTypeHeader ) : eZ\Publish\API\Repository\Values\ValueObject
$responseBody string Body/content of the response (with the object)
$contentTypeHeader string Value of the content-type header
return eZ\Publish\API\Repository\Values\ValueObject

createRequestObject() protected method

Create an object of the specified type.
protected createRequestObject ( string $objectType )
$objectType string the name of the object to be created

decomposeObjectHeader() protected method

Decompose the header to get only the object type of the accept/conten-type headers.
protected decomposeObjectHeader ( $header ) : false | string
return false | string Decomposed string if found, false other wise

getRequestObject() public method

Get the request object.
public getRequestObject ( ) : eZ\Publish\API\Repository\Values\ValueObject
return eZ\Publish\API\Repository\Values\ValueObject

getResponseError() protected method

Get property from the returned Exception.
protected getResponseError ( string $property ) : integer | mixed | string
$property string Property to return
return integer | mixed | string Property

getResponseObject() public method

Get the response object (if it's not converted do the conversion also).
public getResponseObject ( ) : eZ\Publish\API\Repository\Values\ValueObject
return eZ\Publish\API\Repository\Values\ValueObject

iSetTheContentTypeHeaderToInVersion() public method

public iSetTheContentTypeHeaderToInVersion ( $contentType, $version )

makeObject() public method

public makeObject ( $type )

makeObjectHeader() protected method

Make content-type/accept header with prefix and type.
protected makeObjectHeader ( $object )

setFieldToEmptyArray() public method

public setFieldToEmptyArray ( $field )

setFieldToValue() public method

public setFieldToValue ( $field, $value )

setHeaderWithObject() public method

public setHeaderWithObject ( $header, $object )

setRestBodyType() protected method

Set body type of requests and responses.
protected setRestBodyType ( string $type )
$type string Type of the REST body

Property Details

$requestObject public_oe property

Since there is a need to prepare an object in several steps it needs to be hold until sent to the request body.
public ValueObject,eZ\Publish\API\Repository\Values $requestObject
return eZ\Publish\API\Repository\Values\ValueObject

$responseObject public_oe property

Same idea as the $requestObject, since we need to verify it step by step it need to be stored (as object) for testing.
public ValueObject,eZ\Publish\API\Repository\Values|Exception,eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext $responseObject
return eZ\Publish\API\Repository\Values\ValueObject | Exception