Skip to content

Commit 4b5e5ee

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [PHPUnitBridge] [PHPUnit Bridge] Remove the table that lists PHPUnit versions Add functional test chapter to mailer Minor tweak added example for limit consuming to specific queue / queues
2 parents 21c684e + 27813fb commit 4b5e5ee

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

components/phpunit_bridge.rst

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -881,18 +881,6 @@ configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as
881881
the ``simple-phpunit`` if it is not provided. It's also possible to set this
882882
env var in the ``phpunit.xml.dist`` file.
883883

884-
By default, these are the PHPUnit versions used depending on the installed PHP versions:
885-
886-
===================== ===============================
887-
Installed PHP version PHPUnit version used by default
888-
===================== ===============================
889-
PHP <= 5.5 PHPUnit 4.8
890-
PHP 5.6 PHPUnit 5.7
891-
PHP 7.0 PHPUnit 6.5
892-
PHP 7.1 PHPUnit 7.5
893-
PHP >= 7.2 PHPUnit 8.3
894-
===================== ===============================
895-
896884
If you have installed the bridge through Composer, you can run it by calling e.g.:
897885

898886
.. code-block:: terminal
@@ -901,7 +889,7 @@ If you have installed the bridge through Composer, you can run it by calling e.g
901889
902890
.. tip::
903891

904-
It's possible to change the base version of PHPUnit by setting the
892+
It's possible to change the PHPUnit version by setting the
905893
``SYMFONY_PHPUNIT_VERSION`` env var in the ``phpunit.xml.dist`` file (e.g.
906894
``<server name="SYMFONY_PHPUNIT_VERSION" value="5.5"/>``). This is the
907895
preferred method as it can be committed to your version control repository.

mailer.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,37 @@ a specific address, instead of the *real* address:
13621362
;
13631363
};
13641364
1365+
Write a Functional Test
1366+
~~~~~~~~~~~~~~~~~~~~~~~
1367+
1368+
To functionally test that an email was sent, and even assert the email content or headers,
1369+
you can use the built in assertions::
1370+
1371+
// tests/Controller/MailControllerTest.php
1372+
namespace App\Tests\Controller;
1373+
1374+
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1375+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1376+
1377+
class MailControllerTest extends WebTestCase
1378+
{
1379+
use MailerAssertionsTrait;
1380+
1381+
public function testMailIsSentAndContentIsOk()
1382+
{
1383+
$client = $this->createClient();
1384+
$client->request('GET', '/mail/send');
1385+
$this->assertResponseIsSuccessful();
1386+
1387+
$this->assertEmailCount(1);
1388+
1389+
$email = $this->getMailerMessage();
1390+
1391+
$this->assertEmailHtmlBodyContains($email, 'Welcome');
1392+
$this->assertEmailTextBodyContains($email, 'Welcome');
1393+
}
1394+
}
1395+
13651396
.. _`high availability`: https://en.wikipedia.org/wiki/High_availability
13661397
.. _`load balancing`: https://en.wikipedia.org/wiki/Load_balancing_(computing)
13671398
.. _`download the foundation-emails.css file`: https://github.com/foundation/foundation-emails/blob/develop/dist/foundation-emails.css

messenger.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,15 @@ transport is always bound to an exchange. By default, the worker consumes from a
606606
queues attached to the exchange of the specified transport. However, there are use
607607
cases to want a worker to only consume from specific queues.
608608

609-
You can limit the worker to only process messages from specific queues:
609+
You can limit the worker to only process messages from specific queue(s):
610610

611611
.. code-block:: terminal
612612
613613
$ php bin/console messenger:consume my_transport --queues=fasttrack
614614
615+
# you can pass the --queues option more than once to process multiple queues
616+
$ php bin/console messenger:consume my_transport --queues=fasttrack1 --queues=fasttrack2
617+
615618
To allow using the ``queues`` option, the receiver must implement the
616619
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\QueueReceiverInterface`.
617620

0 commit comments

Comments
 (0)