8000 [Mailer] Add a MailerAssertionsTrait in KernelTestCase · Issue #35510 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mailer] Add a MailerAssertionsTrait in KernelTestCase #35510

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

Closed
adrienfr opened this issue Jan 29, 2020 · 0 comments · Fixed by #35534
Closed

[Mailer] Add a MailerAssertionsTrait in KernelTestCase #35510

adrienfr opened this issue Jan 29, 2020 · 0 comments · Fixed by #35534

Comments

@adrienfr
Copy link
Contributor

Description
Since 4.4, we have new PHPUnit constraints for the mailer component, but these are only available with WebTestCase and not KernelTestCase. I think this would be useful to access these constraints from both TestCase. If the email is queued, we could use the assertQueuedEmailCount() function.

Example
For instance, I have a service which sends an email with an attached document, I would like to test that the email is correctly sent and that there is an attached document with it.

@fabpot fabpot added the Mailer label Jan 29, 2020
@xabbuh xabbuh added the Feature label Jan 31, 2020
@fabpot fabpot closed this as completed Feb 4, 2020
fabpot added a commit that referenced this issue Feb 4, 2020
…estCase (adrienfr)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase

| Q             | A
| ------------- | ---
| Branch?       | 4.4+
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35510
| License       | MIT
| Doc PR        |

Since 4.4, we have new PHPUnit constraints for the mailer component, but these are only available with `WebTestCase` and not `KernelTestCase`. I think this would be useful to access these constraints from both TestCase.

I don't know if I should move these [tests](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php) or add new ones only for `KernelTestCase`?

Commits
-------

1b1ab29 [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0