Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createHttpClient example
$registrationRequest
=
$handshake
->
assembleRequest
(
)
;
$handshakeMock
=
$this
->
createMock
(
StoreHandshake::
class
)
;
$handshakeMock
->
method
(
'assembleRequest'
)
->
willReturn
(
$registrationRequest
)
;
$handshakeFactory
=
$this
->
createMock
(
HandshakeFactory::
class
)
;
$handshakeFactory
->
expects
(
static
::
once
(
)
)
->
method
(
'create'
)
->
willReturn
(
$handshakeMock
)
;
$httpClient
=
$this
->
createHttpClient
(
[
new
RequestException
(
'Unknown app',
$registrationRequest
)
,
]
)
;
$appRegistrationService
=
$this
->
createAppRegistrationService
(
$handshakeFactory
,
$httpClient
)
;
static
::
expectException
(
AppRegistrationException::
class
)
;
static
::
expectExceptionMessage
(
'App registration for "test" failed: Unknown app'
)
;
$appRegistrationService
->
registerApp
(
$manifest
, 'id', 's3cr3t-4cc3s-k3y', Context::
createDefaultContext
(
)
)
;
}