Skip to content

Commit 577e87b

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Minor reword Fix empty_data option description of TextareaType update mailer testing documentation Use when@dev insteadof dev/mailer.yaml
2 parents ada8b62 + 76a7847 commit 577e87b

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

mailer.rst

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ and headers.
505505

506506
.. code-block:: yaml
507507
508-
# config/packages/dev/mailer.yaml
508+
# config/packages/mailer.yaml
509509
framework:
510510
mailer:
511511
envelope:
@@ -1360,10 +1360,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
13601360

13611361
.. code-block:: yaml
13621362
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'
13671368
13681369
.. code-block:: xml
13691370
@@ -1408,11 +1409,12 @@ a specific address, instead of the *real* address:
14081409

14091410
.. code-block:: yaml
14101411
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']
14161418
14171419
.. code-block:: xml
14181420
@@ -1451,22 +1453,22 @@ a specific address, instead of the *real* address:
14511453
Write a Functional Test
14521454
~~~~~~~~~~~~~~~~~~~~~~~
14531455

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`::
14561461

14571462
// tests/Controller/MailControllerTest.php
14581463
namespace App\Tests\Controller;
14591464

1460-
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
14611465
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
14621466

14631467
class MailControllerTest extends WebTestCase
14641468
{
1465-
use MailerAssertionsTrait;
1466-
14671469
public function testMailIsSentAndContentIsOk()
14681470
{
1469-
$client = $this->createClient();
1471+
$client = static::createClient();
14701472
$client->request('GET', '/mail/send');
14711473
$this->assertResponseIsSuccessful();
14721474

reference/forms/types/textarea.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
3535

3636
.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
3737

38-
The default value is ``''`` (the empty string).
38+
From an HTTP perspective, submitted data is always a string or an array of strings.
39+
So by default, the form will treat any empty string as null. If you prefer to get
40+
an empty string, explicitly set the ``empty_data`` option to an empty string.
3941

4042
.. include:: /reference/forms/types/options/empty_data_description.rst.inc
4143

testing.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,8 @@ Crawler Assertions
10391039
Asserts that value of the field of the first form matching the given
10401040
selector does (not) equal the expected value.
10411041

1042+
.. _mailer-assertions:
1043+
10421044
Mailer Assertions
10431045
.................
10441046

0 commit comments

Comments
 (0)