Skip to content

Commit 040bca2

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

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:
@@ -1648,10 +1648,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
16481648

16491649
.. code-block:: yaml
16501650
1651-
# config/packages/dev/mailer.yaml
1652-
framework:
1653-
mailer:
1654-
dsn: 'null://null'
1651+
# config/packages/mailer.yaml
1652+
when@dev:
1653+
framework:
1654+
mailer:
1655+
dsn: 'null://null'
16551656
16561657
.. code-block:: xml
16571658
@@ -1696,11 +1697,12 @@ a specific address, instead of the *real* address:
16961697

16971698
.. code-block:: yaml
16981699
1699-
# config/packages/dev/mailer.yaml
1700-
framework:
1701-
mailer:
1702-
envelope:
1703-
recipients: ['youremail@example.com']
1700+
# config/packages/mailer.yaml
1701+
when@dev:
1702+
framework:
1703+
mailer:
1704+
envelope:
1705+
recipients: ['youremail@example.com']
17041706
17051707
.. code-block:: xml
17061708
@@ -1739,22 +1741,22 @@ a specific address, instead of the *real* address:
17391741
Write a Functional Test
17401742
~~~~~~~~~~~~~~~~~~~~~~~
17411743

1742-
To functionally test that an email was sent, and even assert the email content or headers,
1743-
you can use the built in assertions::
1744+
Symfony provides lots of :ref:`built-in mailer assertions <mailer-assertions>`
1745+
to functionally test that an email was sent, its contents or headers, etc.
1746+
They are available in test classes extending
1747+
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase` or when using
1748+
the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`::
17441749

17451750
// tests/Controller/MailControllerTest.php
17461751
namespace App\Tests\Controller;
17471752

1748-
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
17491753
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
17501754

17511755
class MailControllerTest extends WebTestCase
17521756
{
1753-
use MailerAssertionsTrait;
1754-
17551757
public function testMailIsSentAndContentIsOk()
17561758
{
1757-
$client = $this->createClient();
1759+
$client = static::createClient();
17581760
$client->request('GET', '/mail/send');
17591761
$this->assertResponseIsSuccessful();
17601762

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
@@ -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)