use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
use Symfony\Component\Messenger\Transport\Sender\SendersLocator;
class SendersLocatorTest extends TestCase
{ 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);