@@ -547,7 +547,7 @@ and headers.
547
547
548
548
.. code-block :: yaml
549
549
550
- # config/packages/dev/ mailer.yaml
550
+ # config/packages/mailer.yaml
551
551
framework :
552
552
mailer :
553
553
envelope :
@@ -1648,10 +1648,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
1648
1648
1649
1649
.. code-block :: yaml
1650
1650
1651
- # config/packages/dev/mailer.yaml
1652
- framework :
1653
- mailer :
1654
- dsn : ' null://null'
1651
+ # config/packages/mailer.yaml
1652
+ when@dev :
1653
+ framework :
1654
+ mailer :
1655
+ dsn : ' null://null'
1655
1656
1656
1657
.. code-block :: xml
1657
1658
@@ -1696,11 +1697,12 @@ a specific address, instead of the *real* address:
1696
1697
1697
1698
.. code-block :: yaml
1698
1699
1699
- # config/packages/dev/mailer.yaml
1700
- framework :
1701
- mailer :
1702
- envelope :
1703
- recipients : ['youremail@example.com']
1700
+ # config/packages/mailer.yaml
1701
+ when@dev :
1702
+ framework :
1703
+ mailer :
1704
+ envelope :
1705
+ recipients : ['youremail@example.com']
1704
1706
1705
1707
.. code-block :: xml
1706
1708
@@ -1739,22 +1741,22 @@ a specific address, instead of the *real* address:
1739
1741
Write a Functional Test
1740
1742
~~~~~~~~~~~~~~~~~~~~~~~
1741
1743
1742
- To functionally test that an email was sent, and even assert the email content or headers,
1743
- you can use the built in assertions::
1744
+ Symfony provides lots of :ref: `built-in mailer assertions <mailer-assertions >`
1745
+ to functionally test that an email was sent, its contents or headers, etc.
1746
+ They are available in test classes extending
1747
+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase ` or when using
1748
+ the :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ MailerAssertionsTrait `::
1744
1749
1745
1750
// tests/Controller/MailControllerTest.php
1746
1751
namespace App\Tests\Controller;
1747
1752
1748
- use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1749
1753
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1750
1754
1751
1755
class MailControllerTest extends WebTestCase
1752
1756
{
1753
- use MailerAssertionsTrait;
1754
-
1755
1757
public function testMailIsSentAndContentIsOk()
1756
1758
{
1757
- $client = $this-> createClient();
1759
+ $client = static:: createClient();
1758
1760
$client->request('GET', '/mail/send');
1759
1761
$this->assertResponseIsSuccessful();
1760
1762
0 commit comments