$p =
new MessagePart((new Email())->
from('fabien@symfony.com'
)->
text('content'
)->
subject('Subject'
));
$this->
assertEquals(new Headers( new ParameterizedHeader('Content-Type', 'message/rfc822',
['name' => 'Subject.eml'
]),
new UnstructuredHeader('Content-Transfer-Encoding', 'base64'
),
new ParameterizedHeader('Content-Disposition', 'attachment',
['name' => 'Subject.eml', 'filename' => 'Subject.eml'
]) ),
$p->
getPreparedHeaders());
} public function testSerialize() { $email =
(new Email())->
from('fabien@symfony.com'
)->
to('you@example.com'
)->
text('content'
);
$email->
getHeaders()->
addIdHeader('Message-ID',
$email->
generateMessageId());
$p =
new MessagePart($email);
$expected =
clone $p;
$this->
assertEquals($expected->
toString(),
unserialize(serialize($p))->
toString());
}}