Skip to content
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

[10.x] Add test for Message ID, References and Custom Headers for Mailables #47791

Merged
merged 1 commit into from Jul 24, 2023
Merged

Conversation

alexbowers
Copy link
Contributor

This PR adds some tests for proving that the Message ID, References and Custom Headers are sent as part of the message.

I couldn't find any tests covering this at the moment.

I also wanted to expand the assertX tests available on Mailer, however, from a fairly brief glance, I don't see how to access these headers without the mail actually being sent.

Any guidance on adding the following would be much appreciated:

  • assertHasMessageId(string $messageId)
  • assertHasReferences(array $references)
  • assertHasCustomHeader(string $key, string $value)

@alexbowers
Copy link
Contributor Author

The purpose of the requested assistance is that I would like to be able to test that I am sending the Mailchimp Subaccount correctly, which is done by adding a header X-MC-Subaccount, but currently I cannot see that exposed in the tests in any way that I can test

@taylorotwell taylorotwell merged commit 236160d into laravel:10.x Jul 24, 2023
15 of 16 checks passed
@taylorotwell
Copy link
Member

@alexbowers can you just call the headers function of your mailable and inspect the returned value?

https://laravel.com/docs/10.x/mail#headers

@alexbowers
Copy link
Contributor Author

I will give that a try, thanks

@alexbowers alexbowers deleted the patch-3 branch July 24, 2023 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants