@@ -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 :
@@ -1662,10 +1662,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
1662
1662
1663
1663
.. code-block :: yaml
1664
1664
1665
- # config/packages/dev/mailer.yaml
1666
- framework :
1667
- mailer :
1668
- dsn : ' null://null'
1665
+ # config/packages/mailer.yaml
1666
+ when@dev :
1667
+ framework :
1668
+ mailer :
1669
+ dsn : ' null://null'
1669
1670
1670
1671
.. code-block :: xml
1671
1672
@@ -1710,11 +1711,12 @@ a specific address, instead of the *real* address:
1710
1711
1711
1712
.. code-block :: yaml
1712
1713
1713
- # config/packages/dev/mailer.yaml
1714
- framework :
1715
- mailer :
1716
- envelope :
1717
- recipients : ['youremail@example.com']
1714
+ # config/packages/mailer.yaml
1715
+ when@dev :
1716
+ framework :
1717
+ mailer :
1718
+ envelope :
1719
+ recipients : ['youremail@example.com']
1718
1720
1719
1721
.. code-block :: xml
1720
1722
@@ -1753,22 +1755,22 @@ a specific address, instead of the *real* address:
1753
1755
Write a Functional Test
1754
1756
~~~~~~~~~~~~~~~~~~~~~~~
1755
1757
1756
- To functionally test that an email was sent, and even assert the email content or headers,
1757
- you can use the built in assertions::
1758
+ Symfony provides lots of :ref: `built-in mailer assertions <mailer-assertions >`
1759
+ to functionally test that an email was sent, its contents or headers, etc.
1760
+ They are available in test classes extending
1761
+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase ` or when using
1762
+ the :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ MailerAssertionsTrait `::
1758
1763
1759
1764
// tests/Controller/MailControllerTest.php
1760
1765
namespace App\Tests\Controller;
1761
1766
1762
- use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1763
1767
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1764
1768
1765
1769
class MailControllerTest extends WebTestCase
1766
1770
{
1767
- use MailerAssertionsTrait;
1768
-
1769
1771
public function testMailIsSentAndContentIsOk()
1770
1772
{
1771
- $client = $this-> createClient();
1773
+ $client = static:: createClient();
1772
1774
$client->request('GET', '/mail/send');
1773
1775
$this->assertResponseIsSuccessful();
1774
1776
0 commit comments