Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
validateRequestSchema example
$this
->
appendNewResponse
(
new
Response
(
200
)
)
;
$this
->executor->
execute
(
$action
, Context::
createDefaultContext
(
)
)
;
/** @var Request $request */
$request
=
$this
->
getLastRequest
(
)
;
static
::
assertEquals
(
'POST',
$request
->
getMethod
(
)
)
;
$body
=
$request
->
getBody
(
)
->
getContents
(
)
;
static
::
assertJson
(
$body
)
;
$result
=
$this
->
validateRequestSchema
(
$body
)
;
$message
=
$this
->
parseSchemaErrors
(
$result
)
;
static
::
assertTrue
(
$result
->
isValid
(
)
,
$message
)
;
$appSecret
=
$action
->
getAppSecret
(
)
;
static
::
assertNotNull
(
$appSecret
)
;
static
::
assertEquals
(
hash_hmac
(
'sha256',
$body
,
$appSecret
)
,
$request
->
getHeaderLine
(
'shopware-shop-signature'
)
)
;