use Symfony\Component\Mailer\Event\MessageEvent;
use Symfony\Component\Mailer\EventListener\MessengerTransportListener;
use Symfony\Component\Messenger\Stamp\TransportNamesStamp;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Header\Headers;
use Symfony\Component\Mime\Message;
class MessengerTransportListenerTest extends TestCase
{ public function testNoMessengerTransportStampsByDefault() { $l =
new MessengerTransportListener();
$envelope =
new Envelope(new Address('sender@example.com'
),
[new Address('recipient@example.com'
)]);
$message =
new Message(new Headers());
$event =
new MessageEvent($message,
$envelope, 'smtp', true
);
$l->
onMessage($event);
$this->
assertEmpty($event->
getStamps());
} public function testMessengerTransportStampViaHeader() { $l =
new MessengerTransportListener();
$envelope =
new Envelope(new Address('sender@example.com'
),
[new Address('recipient@example.com'
)]);