Skip to content

Incomplete Mail testing section in 5.3, no "how to" on email testing #15922

Closed
@AntonioCS

Description

@AntonioCS

Hello,

I googled for email testing in symfony and got this page: https://symfony.com/doc/4.1/email/testing.html
This is for 4.1 but I am using symfony 5.3 so I clicked the link (which is on the page) the updated version of this page
I was taken to this page: https://symfony.com/doc/current/mailer.html

This page is a "How to" page and it's missing a testing section. The reader is left to guess how to test emails in symfony 5.3.
I have asked this in the symfony slack #support channel and got a bit of help but nothing conclusive.

I did a bit more googling and found: symfony/symfony#39511
Where is seems the user that posted the issue has a similar issue and when @xabbuh suggested enabling the profiler all the issues went away.
So I've done:

#config/packages/test/framework.yaml
framework:
    profiler: ~

I've also done:

       $this->client = static::createClient();

      .....
            $this->client->enableProfiler();
       ....

        return $this->client->request(....

But when I do this:

self::assertEmailCount(1);

I still get an error saying I have sent zero emails.

When I run code locally I can see an email in mailhog. So I know an email is being sent.
I think email testing is crucial in any application. I would do PR on how to test emails, if I actually new all the steps to test email, but I don't :(

Can someone please update the docs regarding this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    MailerTestinghasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions