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

TestMailer - Add Headers attribute in order for tests to asserts its contents #10172

Merged
merged 1 commit into from
Jan 9, 2022

Conversation

ssmarco
Copy link

@ssmarco ssmarco commented Dec 10, 2021

When running tests and finding that an email has been sent, in SS3 we are able to assert if the emails sent contains Cc/Bcc using customHeaders attribute. This pull request re-adds that feature using Headers attribute.

Reference:

public function sendPlain($to, $from, $subject, $plainContent, $attachedFiles = false, $customheaders = false) {

@dhensby
Copy link
Contributor

dhensby commented Jan 7, 2022

Wouldn't it be better to return/save all the headers not just these two?

@ssmarco
Copy link
Author

ssmarco commented Jan 7, 2022

Good point @dhensby, added all headers as suggested.

Copy link
Contributor

@dhensby dhensby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. It would be nice to squash these commits, but not a blocker

Copy link
Contributor

@michalkleiner michalkleiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ssmarco. Please squash the commits and remove the reference to SS3 to avoid confusion. The commit message can be something along the lines of "ENH Save all headers when testing email sending" or similar.

contents

Update TestMailer.php

Good point, adding all headers as suggested.
@ssmarco ssmarco changed the title SS3 has customHeaders before with Cc/Bcc addresses TestMailer - Add Headers attribute in order for tests to asserts its contents Jan 9, 2022
@ssmarco
Copy link
Author

ssmarco commented Jan 9, 2022

Thanks @ssmarco. Please squash the commits and remove the reference to SS3 to avoid confusion. The commit message can be something along the lines of "ENH Save all headers when testing email sending" or similar.

Thanks. Done

@michalkleiner michalkleiner merged commit acb04e3 into silverstripe:4 Jan 9, 2022
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.

3 participants