Skip to content

Commit efc6a79

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: Minor reword Fix empty_data option description of TextareaType update mailer testing documentation Use when@dev insteadof dev/mailer.yaml
2 parents f2dc408 + 040bca2 commit efc6a79

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
@@ -547,7 +547,7 @@ and headers.
547547

548548
.. code-block:: yaml
549549
550-
# config/packages/dev/mailer.yaml
550+
# config/packages/mailer.yaml
551551
framework:
552552
mailer:
553553
envelope:
@@ -1662,10 +1662,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
16621662

16631663
.. code-block:: yaml
16641664
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'
16691670
16701671
.. code-block:: xml
16711672
@@ -1710,11 +1711,12 @@ a specific address, instead of the *real* address:
17101711

17111712
.. code-block:: yaml
17121713
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']
17181720
17191721
.. code-block:: xml
17201722
@@ -1753,22 +1755,22 @@ a specific address, instead of the *real* address:
17531755
Write a Functional Test
17541756
~~~~~~~~~~~~~~~~~~~~~~~
17551757

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

17591764
// tests/Controller/MailControllerTest.php
17601765
namespace App\Tests\Controller;
17611766

1762-
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
17631767
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
17641768

17651769
class MailControllerTest extends WebTestCase
17661770
{
1767-
use MailerAssertionsTrait;
1768-
17691771
public function testMailIsSentAndContentIsOk()
17701772
{
1771-
$client = $this->createClient();
1773+
$client = static::createClient();
17721774
$client->request('GET', '/mail/send');
17731775
$this->assertResponseIsSuccessful();
17741776

reference/forms/types/textarea.rst

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

4343
.. include:: /reference/forms/types/options/empty_data_declaration.rst.inc
4444

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

4749
.. include:: /reference/forms/types/options/empty_data_description.rst.inc
4850

testing.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,8 @@ Crawler Assertions
10451045

10461046
The ``assertSelectorCount()`` method was introduced in Symfony 6.3.
10471047

1048+
.. _mailer-assertions:
1049+
10481050
Mailer Assertions
10491051
.................
10501052

0 commit comments

Comments
 (0)