@@ -512,7 +512,7 @@ and headers.
512
512
513
513
.. code-block :: yaml
514
514
515
- # config/packages/dev/ mailer.yaml
515
+ # config/packages/mailer.yaml
516
516
framework :
517
517
mailer :
518
518
envelope :
@@ -1440,10 +1440,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
1440
1440
1441
1441
.. code-block :: yaml
1442
1442
1443
- # config/packages/dev/mailer.yaml
1444
- framework :
1445
- mailer :
1446
- dsn : ' null://null'
1443
+ # config/packages/mailer.yaml
1444
+ when@dev :
1445
+ framework :
1446
+ mailer :
1447
+ dsn : ' null://null'
1447
1448
1448
1449
.. code-block :: xml
1449
1450
@@ -1488,11 +1489,12 @@ a specific address, instead of the *real* address:
1488
1489
1489
1490
.. code-block :: yaml
1490
1491
1491
- # config/packages/dev/mailer.yaml
1492
- framework :
1493
- mailer :
1494
- envelope :
1495
- recipients : ['youremail@example.com']
1492
+ # config/packages/mailer.yaml
1493
+ when@dev :
1494
+ framework :
1495
+ mailer :
1496
+ envelope :
1497
+ recipients : ['youremail@example.com']
1496
1498
1497
1499
.. code-block :: xml
1498
1500
@@ -1531,22 +1533,22 @@ a specific address, instead of the *real* address:
1531
1533
Write a Functional Test
1532
1534
~~~~~~~~~~~~~~~~~~~~~~~
1533
1535
1534
- To functionally test that an email was sent, and even assert the email content or headers,
1535
- you can use the built in assertions::
1536
+ Symfony provides lots of :ref: `built-in mailer assertions <mailer-assertions >`
1537
+ to functionally test that an email was sent, its contents or headers, etc.
1538
+ They are available in test classes extending
1539
+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase ` or when using
1540
+ the :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ MailerAssertionsTrait `::
1536
1541
1537
1542
// tests/Controller/MailControllerTest.php
1538
1543
namespace App\Tests\Controller;
1539
1544
1540
- use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1541
1545
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1542
1546
1543
1547
class MailControllerTest extends WebTestCase
1544
1548
{
1545
- use MailerAssertionsTrait;
1546
-
1547
1549
public function testMailIsSentAndContentIsOk()
1548
1550
{
1549
- $client = $this-> createClient();
1551
+ $client = static:: createClient();
1550
1552
$client->request('GET', '/mail/send');
1551
1553
$this->assertResponseIsSuccessful();
1552
1554
0 commit comments