Skip to content

Commit feb8baa

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: [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 Fix anchor location
2 parents 752f702 + 5b36f5b commit feb8baa

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

components/phpunit_bridge.rst

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,6 @@ to completely disable the deprecation helper. This is useful to make use of the
341341
rest of features provided by this component without getting errors or messages
342342
related to deprecations.
343343

344-
.. _write-assertions-about-deprecations:
345-
346344
Deprecation Notices at Autoloading Time
347345
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348346

@@ -389,6 +387,8 @@ For turning the verbose output off and write it to a log file instead you can us
389387

390388
The ``logFile`` option was introduced in Symfony 5.3.
391389

390+
.. _write-assertions-about-deprecations:
391+
392392
Write Assertions about Deprecations
393393
-----------------------------------
394394

@@ -877,7 +877,7 @@ You can either:
877877

878878
// config/bootstrap.php
879879
use Symfony\Bridge\PhpUnit\ClockMock;
880-
880+
881881
// ...
882882
if ('test' === $_SERVER['APP_ENV']) {
883883
ClockMock::register('Acme\\MyClassTest\\');
@@ -903,18 +903,6 @@ configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as
903903
the ``simple-phpunit`` if it is not provided. It's also possible to set this
904904
env var in the ``phpunit.xml.dist`` file.
905905

906-
By default, these are the PHPUnit versions used depending on the installed PHP versions:
907-
908-
===================== ===============================
909-
Installed PHP version PHPUnit version used by default
910-
===================== ===============================
911-
PHP <= 5.5 PHPUnit 4.8
912-
PHP 5.6 PHPUnit 5.7
913-
PHP 7.0 PHPUnit 6.5
914-
PHP 7.1 PHPUnit 7.5
915-
PHP >= 7.2 PHPUnit 8.3
916-
===================== ===============================
917-
918906
If you have installed the bridge through Composer, you can run it by calling e.g.:
919907

920908
.. code-block:: terminal
@@ -923,7 +911,7 @@ If you have installed the bridge through Composer, you can run it by calling e.g
923911
924912
.. tip::
925913

926-
It's possible to change the base version of PHPUnit by setting the
914+
It's possible to change the PHPUnit version by setting the
927915
``SYMFONY_PHPUNIT_VERSION`` env var in the ``phpunit.xml.dist`` file (e.g.
928916
``<server name="SYMFONY_PHPUNIT_VERSION" value="5.5"/>``). This is the
929917
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
@@ -1444,6 +1444,37 @@ a specific address, instead of the *real* address:
14441444
;
14451445
};
14461446
1447+
Write a Functional Test
1448+
~~~~~~~~~~~~~~~~~~~~~~~
1449+
1450+
To functionally test that an email was sent, and even assert the email content or headers,
1451+
you can use the built in assertions::
1452+
1453+
// tests/Controller/MailControllerTest.php
1454+
namespace App\Tests\Controller;
1455+
1456+
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1457+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1458+
1459+
class MailControllerTest extends WebTestCase
1460+
{
1461+
use MailerAssertionsTrait;
1462+
1463+
public function testMailIsSentAndContentIsOk()
1464+
{
1465+
$client = $this->createClient();
1466+
$client->request('GET', '/mail/send');
1467+
$this->assertResponseIsSuccessful();
1468+
1469+
$this->assertEmailCount(1);
1470+
1471+
$email = $this->getMailerMessage();
1472+
1473+
$this->assertEmailHtmlBodyContains($email, 'Welcome');
1474+
$this->assertEmailTextBodyContains($email, 'Welcome');
1475+
}
1476+
}
1477+
14471478
.. _`high availability`: https://en.wikipedia.org/wiki/High_availability
14481479
.. _`load balancing`: https://en.wikipedia.org/wiki/Load_balancing_(computing)
14491480
.. _`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
@@ -611,12 +611,15 @@ transport is always bound to an exchange. By default, the worker consumes from a
611611
queues attached to the exchange of the specified transport. However, there are use
612612
cases to want a worker to only consume from specific queues.
613613

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

616616
.. code-block:: terminal
617617
618618
$ php bin/console messenger:consume my_transport --queues=fasttrack
619619
620+
# you can pass the --queues option more than once to process multiple queues
621+
$ php bin/console messenger:consume my_transport --queues=fasttrack1 --queues=fasttrack2
622+
620623
To allow using the ``queues`` option, the receiver must implement the
621624
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\QueueReceiverInterface`.
622625

0 commit comments

Comments
 (0)