@@ -505,7 +505,7 @@ and headers.
505
505
506
506
.. code-block :: yaml
507
507
508
- # config/packages/dev/ mailer.yaml
508
+ # config/packages/mailer.yaml
509
509
framework :
510
510
mailer :
511
511
envelope :
@@ -1360,10 +1360,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
1360
1360
1361
1361
.. code-block :: yaml
1362
1362
1363
- # config/packages/dev/mailer.yaml
1364
- framework :
1365
- mailer :
1366
- dsn : ' null://null'
1363
+ # config/packages/mailer.yaml
1364
+ when@dev :
1365
+ framework :
1366
+ mailer :
1367
+ dsn : ' null://null'
1367
1368
1368
1369
.. code-block :: xml
1369
1370
@@ -1408,11 +1409,12 @@ a specific address, instead of the *real* address:
1408
1409
1409
1410
.. code-block :: yaml
1410
1411
1411
- # config/packages/dev/mailer.yaml
1412
- framework :
1413
- mailer :
1414
- envelope :
1415
- recipients : ['youremail@example.com']
1412
+ # config/packages/mailer.yaml
1413
+ when@dev :
1414
+ framework :
1415
+ mailer :
1416
+ envelope :
1417
+ recipients : ['youremail@example.com']
1416
1418
1417
1419
.. code-block :: xml
1418
1420
@@ -1451,22 +1453,22 @@ a specific address, instead of the *real* address:
1451
1453
Write a Functional Test
1452
1454
~~~~~~~~~~~~~~~~~~~~~~~
1453
1455
1454
- To functionally test that an email was sent, and even assert the email content or headers,
1455
- you can use the built in assertions::
1456
+ Symfony provides lots of :ref: `built-in mailer assertions <mailer-assertions >`
1457
+ to functionally test that an email was sent, its contents or headers, etc.
1458
+ They are available in test classes extending
1459
+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase ` or when using
1460
+ the :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ MailerAssertionsTrait `::
1456
1461
1457
1462
// tests/Controller/MailControllerTest.php
1458
1463
namespace App\Tests\Controller;
1459
1464
1460
- use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1461
1465
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1462
1466
1463
1467
class MailControllerTest extends WebTestCase
1464
1468
{
1465
- use MailerAssertionsTrait;
1466
-
1467
1469
public function testMailIsSentAndContentIsOk()
1468
1470
{
1469
- $client = $this-> createClient();
1471
+ $client = static:: createClient();
1470
1472
$client->request('GET', '/mail/send');
1471
1473
$this->assertResponseIsSuccessful();
1472
1474
0 commit comments