Description
Symfony version(s) affected
7.2.4
Description
Hello !
I've been trying to upgrade our project from 7.1.8 to 7.2.4, however, I'm getting an issue while running our test suites. We have a test that ensures that transport is defined using the X-Transport
header. Even though the documentation says that the header is removed after sending the email, we could test the header like so :
$email = $this->getMailerMessage();
self::assertEmailHeaderSame($email, 'X-Transport', 'mailjet');
Now that I upgraded to 7.2.4, the header is removed. Then, I tried to test that the message was successfully sent using the mailjet
transport using the transport
parameter of the getMailerMessage
method, but my message will not be returned.
The transport seems lost in test environment. Is it a bug ? Am I missing something ? Is there a better way to test the transport ?
How to reproduce
Setup a test multi-transport mailer configuration :
framework:
mailer:
transports:
transport_a: '%env(MAILER_DSN_TRANSPORT_A)%'
transport_b: '%env(MAILER_DSN_TRANSPORT_B)%'
Send a mail using a specific transport :
$message->getHeaders()->addTextHeader('X-Transport', 'transport_b');
$this->mailer->send($message);
Write a functional test checking for transport :
class MyTest extends KernelTestCase
{
use MailerAssertionsTrait;
public function test(): void
{
// send mail
$email = $this->getMailerMessage();
self::assertEmailHeaderSame($email, 'X-Transport', 'transport_b');
}
}
Possible Solution
No response
Additional Context
No response