Exemplo n.º 1
0
 public function test_that_it_can_set_and_get_attachments()
 {
     $attachment = $this->mock(Attachment::class);
     $this->message->addAttachment($attachment);
     $attachments = $this->message->getAttachments();
     $this->assertSame($attachment, $attachments[0]);
 }
 /**
  * Sets the attachments
  *
  * @param Message       $message      The mail message
  * @param Swift_Message $swiftMessage The Swift Mailer message
  *
  * @return void
  */
 protected function setAttachments(Message $message, Swift_Message $swiftMessage)
 {
     /** @var Attachment $attachment */
     foreach ($message->getAttachments() as $attachment) {
         $swiftAttachment = Swift_Attachment::newInstance($attachment->getBody(), $attachment->getFileName(), $attachment->getContentType());
         $swiftAttachment->setId($attachment->getId());
         $swiftAttachment->setDisposition($attachment->getDisposition());
         $swiftMessage->attach($swiftAttachment);
     }
 }