Skip to content

[Mailer] update mailer testing documentation #17727

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

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mailer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1534,21 +1534,21 @@ Write a Functional Test
~~~~~~~~~~~~~~~~~~~~~~~

To functionally test that an email was sent, and even assert the email content or headers,
you can use the built in assertions::
you can use the built in assertions provided by :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
you can use the built in assertions provided by :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`.
you can use the built in assertions provided by the
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`.


See :ref:`testing documentation <mailer-assertions>` for the list of available assertions.::
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
See :ref:`testing documentation <mailer-assertions>` for the list of available assertions.::
See :ref:`testing documentation <mailer-assertions>` for the list of available assertions::


// tests/Controller/MailControllerTest.php
namespace App\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class MailControllerTest extends WebTestCase
{
use MailerAssertionsTrait;

public function testMailIsSentAndContentIsOk()
{
$client = $this->createClient();
$client = static::createClient();
$client->request('GET', '/mail/send');
$this->assertResponseIsSuccessful();

Expand Down