-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] Add assertEmailAddressNotContains
#60740
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
base: 7.4
Are you sure you want to change the base?
[Mailer] Add assertEmailAddressNotContains
#60740
Conversation
@@ -1,6 +1,10 @@ | |||
CHANGELOG | |||
========= | |||
|
|||
7.4 | |||
--- | |||
* added `assertEmailAddressNotContains()` to `MailerAssertionsTrait`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* added `assertEmailAddressNotContains()` to `MailerAssertionsTrait`. | |
* Add `assertEmailAddressNotContains()` to the `MailerAssertionsTrait` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your suggestion, and I've made that change.
Thanks a lot for your help!
$this->assertEmailAddressNotContains($email, 'To', 'fabien@fake.symfony.com'); | ||
$this->assertEmailAddressNotContains($email, 'To', 'thomas@fake.symfony.com'); | ||
$this->assertEmailAddressNotContains($email, 'Reply-To', 'me@fake.symfony.com'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that these assertions are redundant, given that the addresses specified have never been used before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think the assertions are an issue, but I’m happy to update the emails if you have any suggestions for alternatives.
Thanks again! 😄❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the emails to helene@symfony.com
. I believe this still tests the same behavior, but this format is more in line with the emails currently used in Symfony tests 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test that cannot fail is not useful. I think you should to add assertions that would actually fail if something breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to clarify a couple of points:
- The method is simply applying a LogicalNot to an existing Constraint that is already implemented and tested.
- If you look at several of the current assertions in the same test file, you'll notice that they cover similar cases to the ones I'm adding now. In fact, the same email is already being tested, just in a different way.
As always, if you have any suggestions, they're more than welcome! 😄
fd6bc22
to
7d47611
Compare
7d47611
to
b64a567
Compare
@@ -1,6 +1,10 @@ | |||
CHANGELOG | |||
========= | |||
|
|||
7.4 | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--- | |
--- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again! The change has been made.
Apologies for the many mistakes in the CHANGELOG.md
, totally my fault 😄
b64a567
to
559d45b
Compare
This PR introduces a new assertion method
assertEmailAddressNotContains()
to theMailerAssertionsTrait
.The new method complements the existing
assertEmailAddressContains()
by allowing developers to assert that a specific email address does not appear in a given header. This addition brings theassertEmailAddressContains
in line with other similar assertion pairs already available in the trait, such as:assertEmailTextBodyContains
/assertEmailTextBodyNotContains
assertEmailHtmlBodyContains
/assertEmailHtmlBodyNotContains
assertEmailSubjectContains
/assertEmailSubjectNotContains
Example usage