Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
SecondMessage example
public
function
testItReturnsTheSenderBasedOnTheMessageClass
(
)
{
$sender
=
$this
->
createMock
(
SenderInterface::
class
)
;
$sendersLocator
=
$this
->
createContainer
(
[
'my_sender' =>
$sender
,
]
)
;
$locator
=
new
SendersLocator
(
[
DummyMessage::
class
=>
[
'my_sender'
]
,
]
,
$sendersLocator
)
;
$this
->
assertSame
(
[
'my_sender' =>
$sender
]
,
iterator_to_array
(
$locator
->
getSenders
(
new
Envelope
(
new
DummyMessage
(
'a'
)
)
)
)
)
;
$this
->
assertSame
(
[
]
,
iterator_to_array
(
$locator
->
getSenders
(
new
Envelope
(
new
SecondMessage
(
)
)
)
)
)
;
}
public
function
testItReturnsTheSenderBasedOnTransportNamesStamp
(
)
{
$mySender
=
$this
->
createMock
(
SenderInterface::
class
)
;
$otherSender
=
$this
->
createMock
(
SenderInterface::
class
)
;
$sendersLocator
=
$this
->
createContainer
(
[
'my_sender' =>
$mySender
,
'other_sender' =>
$otherSender
,
]
)
;
$locator
=
new
SendersLocator
(
[