From aeb4053df1df4f9aaa1e51792d092d66304236f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 25 Feb 2020 18:31:25 +0100 Subject: [PATCH 1/3] Fixed CoverageListener usage with custom SUT solver See https://github.com/symfony/symfony/blob/d0e5593b1fcc88c0738f1adf2c452f84f19207f3/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php#L81-L95 --- components/phpunit_bridge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index a99752764d9..3ed9cdc5e5a 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -710,7 +710,7 @@ your application, you can use your own SUT (System Under Test) solver: The ``My\Namespace\SutSolver::solve`` can be any PHP callable and receives the -current test classname as its first argument. +current test as its first argument. Finally, the listener can also display warning messages when the SUT solver does not find the SUT: From 73e088c786cc3010ae0289f00335dc4f515ea26e Mon Sep 17 00:00:00 2001 From: Yohann Durand Date: Mon, 24 Feb 2020 17:35:30 +0100 Subject: [PATCH 2/3] Update messenger.rst formating improve --- components/messenger.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/messenger.rst b/components/messenger.rst index 33132889234..43272beb591 100644 --- a/components/messenger.rst +++ b/components/messenger.rst @@ -58,12 +58,12 @@ Concepts both when a message is originally dispatched and again later when a message is received from a transport, -**Envelope** +**Envelope**: Messenger specific concept, it gives full flexibility inside the message bus, by wrapping the messages into it, allowing to add useful information inside through *envelope stamps*. -**Envelope Stamps** +**Envelope Stamps**: Piece of information you need to attach to your message: serializer context to use for transport, markers identifying a received message or any sort of metadata your middleware or transport layer may use. From e55dcadb5477c287bbdaf6f0d41c5a8cfbfa7da4 Mon Sep 17 00:00:00 2001 From: Romain Monteil Date: Thu, 27 Feb 2020 08:52:02 +0100 Subject: [PATCH 3/3] Update multiple services example This PR propose to replace SwiftMailer with the Mailer component and to add the Logger service for a better understanding how to inject multiple services --- service_container.rst | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/service_container.rst b/service_container.rst index 27685eecf36..54e73645f60 100644 --- a/service_container.rst +++ b/service_container.rst @@ -295,13 +295,15 @@ made. To do that, you create a new class:: namespace App\Updates; use App\Service\MessageGenerator; + use Symfony\Component\Mailer\MailerInterface; + use Symfony\Component\Mime\Email; class SiteUpdateManager { private $messageGenerator; private $mailer; - public function __construct(MessageGenerator $messageGenerator, \Swift_Mailer $mailer) + public function __construct(MessageGenerator $messageGenerator, MailerInterface $mailer) { $this->messageGenerator = $messageGenerator; $this->mailer = $mailer; @@ -311,19 +313,21 @@ made. To do that, you create a new class:: { $happyMessage = $this->messageGenerator->getHappyMessage(); - $message = (new \Swift_Message('Site update just happened!')) - ->setFrom('admin@example.com') - ->setTo('manager@example.com') - ->addPart( - 'Someone just updated the site. We told them: '.$happyMessage - ); + $email = (new Email()) + ->from('admin@example.com') + ->to('manager@example.com') + ->subject('Site update just happened!') + ->text('Someone just updated the site. We told them: '.$happyMessage); - return $this->mailer->send($message) > 0; + $this->mailer->send($email); + + // ... } } -This needs the ``MessageGenerator`` *and* the ``Swift_Mailer`` service. That's no -problem! In fact, this new service is ready to be used. In a controller, for example, +This needs the ``MessageGenerator`` *and* the ``Mailer`` service. That's no +problem, we ask them by type hinting their class and interface names! +Now, this new service is ready to be used. In a controller, for example, you can type-hint the new ``SiteUpdateManager`` class and use it:: // src/Controller/SiteController.php