Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
AmazonSqsFifoStamp example
$serializer
=
$this
->
createMock
(
SerializerInterface::
class
)
;
$serializer
->
method
(
'encode'
)
->
with
(
$envelope
)
->
willReturnOnConsecutiveCalls
(
$encoded
)
;
$sender
=
new
AmazonSqsSender
(
$connection
,
$serializer
)
;
$sender
->
send
(
$envelope
)
;
}
public
function
testSendWithAmazonSqsFifoStamp
(
)
{
$envelope
=
(
new
Envelope
(
new
DummyMessage
(
'Oy'
)
)
)
->
with
(
$stamp
=
new
AmazonSqsFifoStamp
(
'testGroup', 'testDeduplicationId'
)
)
;
$encoded
=
[
'body' => '...', 'headers' =>
[
'type' => DummyMessage::
class
]
]
;
$connection
=
$this
->
createMock
(
Connection::
class
)
;
$connection
->
expects
(
$this
->
once
(
)
)
->
method
(
'send'
)
->
with
(
$encoded
[
'body'
]
,
$encoded
[
'headers'
]
, 0,
$stamp
->
getMessageGroupId
(
)
,
$stamp
->
getMessageDeduplicationId
(
)
)
;
$serializer
=
$this
->
createMock
(
SerializerInterface::
class
)
;
$serializer
->
method
(
'encode'
)
->
with
(
$envelope
)
->
willReturnOnConsecutiveCalls
(
$encoded
)
;
$sender
=
new
AmazonSqsSender
(
$connection
,
$serializer
)
;