use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillSmtpTransport;
use Symfony\Component\Mailer\Header\MetadataHeader;
use Symfony\Component\Mailer\Header\TagHeader;
use Symfony\Component\Mime\Email;
class MandrillSmtpTransportTest extends TestCase
{ public function testTagAndMetadataHeaders() { $email =
new Email();
$email->
getHeaders()->
addTextHeader('foo', 'bar'
);
$email->
getHeaders()->
add(new TagHeader('password-reset,user'
));
$email->
getHeaders()->
add(new TagHeader('another'
));
$email->
getHeaders()->
add(new MetadataHeader('Color', 'blue'
));
$email->
getHeaders()->
add(new MetadataHeader('Client-ID', '12345'
));
$transport =
new MandrillSmtpTransport('user', 'password'
);
$method =
new \
ReflectionMethod(MandrillSmtpTransport::
class, 'addMandrillHeaders'
);
$method->
invoke($transport,
$email);
$this->
assertCount(3,
$email->
getHeaders()->
toArray());
$this->
assertSame('foo: bar',
$email->
getHeaders()->
get('FOO'
)->
toString());
$this->
assertSame('X-MC-Tags: password-reset,user,another',
$email->
getHeaders()->
get('X-MC-Tags'
)->
toString());