Skip to content

[Mailer] re-add test #47106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,52 @@ public function testSendFullEmailWithSuccess()
$this->assertEquals([new Address('bcc@example.com')], $sentMessage->getOriginalMessage()->getBcc());
}

public function testSendEmailWithAttachmentsWithSuccess()
{
$email = $this->basicValidEmail()
->text('foobar')
->attach('some attachment', 'attachment.txt', 'text/plain')
->embed('some inline attachment', 'inline.txt', 'text/plain')
;

$sentMessage = $this->transport->send($email);

$this->assertInstanceOf(SentMessage::class, $sentMessage);
$this->assertStringMatchesFormat(
<<<'TXT'
%a
Content-Type: multipart/mixed; boundary=%s

--%s
Content-Type: multipart/related; boundary=%s

--%s
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

foobar
--%s
Content-ID: %s
Content-Type: text/plain; name=inline.txt
Content-Transfer-Encoding: base64
Content-Disposition: inline; name=inline.txt; filename=inline.txt

c29tZSBpbmxpbmUgYXR0YWNobWVudA==
--%s--

--%s
Content-Type: text/plain; name=attachment.txt
Content-Transfer-Encoding: base64
Content-Disposition: attachment; name=attachment.txt;
filename=attachment.txt

c29tZSBhdHRhY2htZW50
--%s--
TXT,
$sentMessage->toString()
);
}

public function testSentMessageShouldCaptureInfobipMessageId()
{
$this->response = new MockResponse('{"messages": [{"messageId": "somexternalMessageId0"}]}');
Expand Down