Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
buildAppResponse example
public
function
__invoke
(
RequestInterface
$request
, array
$options
)
: PromiseInterface
{
if
(
$this
->inner->
count
(
)
> 0
)
{
return
\
call_user_func
(
$this
->inner,
$request
,
$options
)
;
}
if
(
$this
->
isRegistration
(
$request
)
)
{
$this
->registrationRequest =
$request
;
$promise
=
new
Promise
(
)
;
$promise
->
resolve
(
new
Response
(
200,
[
]
,
$this
->
buildAppResponse
(
$request
)
)
)
;
return
$promise
;
}
if
(
$this
->
isRegistrationConfirmation
(
$request
)
)
{
$this
->confirmationRequest =
$request
;
$promise
=
new
Promise
(
)
;
$promise
->
resolve
(
new
Response
(
200
)
)
;
return
$promise
;
}
public
function
testRegisterPrivateApp
(
)
: void
{
$id
= Uuid::
randomHex
(
)
;
$secretAccessKey
= AccessKeyHelper::
generateSecretAccessKey
(
)
;
$this
->
createApp
(
$id
)
;
$manifest
= Manifest::
createFromXmlFile
(
__DIR__ . '/_fixtures/minimal/manifest.xml'
)
;
$appSecret
= 'dont_tell';
$appResponseBody
=
$this
->
buildAppResponse
(
$manifest
,
$appSecret
)
;
$this
->
appendNewResponse
(
new
Response
(
200,
[
]
,
$appResponseBody
)
)
;
$this
->
appendNewResponse
(
new
Response
(
200,
[
]
)
)
;
$this
->registrator->
registerApp
(
$manifest
,
$id
,
$secretAccessKey
, Context::
createDefaultContext
(
)
)
;
$registrationRequest
=
$this
->
getPastRequest
(
0
)
;
$setup
=
$manifest
->
getSetup
(
)
;
static
::
assertNotNull
(
$setup
)
;