Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getWebhookEntity example
$this
->clientMock =
new
MockHandler
(
[
new
Response
(
200
)
]
)
;
$this
->client =
new
Client
(
[
'handler' => HandlerStack::
create
(
$this
->clientMock
)
]
)
;
$this
->container =
new
Container
(
)
;
$this
->eventFactory =
$this
->
createMock
(
HookableEventFactory::
class
)
;
$this
->bus =
new
CollectingMessageBus
(
)
;
}
public
function
testDispatchWithWebhooksSync
(
)
: void
{
$event
=
new
AppFlowActionEvent
(
'foobar',
[
'foo' => 'bar'
]
,
[
'foo' => 'bar'
]
)
;
$webhookEntity
=
$this
->
getWebhookEntity
(
$event
->
getName
(
)
)
;
$this
->
prepareContainer
(
$webhookEntity
)
;
$this
->dispatcher->
expects
(
static
::
once
(
)
)
->
method
(
'dispatch'
)
->
with
(
$event
,
$event
->
getName
(
)
)
->
willReturn
(
$event
)
;
$this
->eventFactory->
expects
(
static
::
once
(
)
)
->
method
(
'createHookablesFor'
)
->
with
(
$event
)
->
willReturn
(
[
$event
]
)
;
$expectedRequest
=
new
Request
(
'POST',
$webhookEntity
->
getUrl
(
)
,
[
'foo' => 'bar',