Skip to content

Commit 363e071

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

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
@@ -512,7 +512,7 @@ and headers.
512512

513513
.. code-block:: yaml
514514
515-
# config/packages/dev/mailer.yaml
515+
# config/packages/mailer.yaml
516516
framework:
517517
mailer:
518518
envelope:
@@ -1440,10 +1440,11 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
14401440

14411441
.. code-block:: yaml
14421442
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'
14471448
14481449
.. code-block:: xml
14491450
@@ -1488,11 +1489,12 @@ a specific address, instead of the *real* address:
14881489

14891490
.. code-block:: yaml
14901491
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']
14961498
14971499
.. code-block:: xml
14981500
@@ -1531,22 +1533,22 @@ a specific address, instead of the *real* address:
15311533
Write a Functional Test
15321534
~~~~~~~~~~~~~~~~~~~~~~~
15331535

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

15371542
// tests/Controller/MailControllerTest.php
15381543
namespace App\Tests\Controller;
15391544

1540-
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
15411545
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
15421546

15431547
class MailControllerTest extends WebTestCase
15441548
{
1545-
use MailerAssertionsTrait;
1546-
15471549
public function testMailIsSentAndContentIsOk()
15481550
{
1549-
$client = $this->createClient();
1551+
$client = static::createClient();
15501552
$client->request('GET', '/mail/send');
15511553
$this->assertResponseIsSuccessful();
15521554

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)