From 88b45799421c4cddf1f6e170d68ff09c60c01d4e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 4 Feb 2020 20:55:13 +0100 Subject: [PATCH] [Mailer] fix typos --- .../Tests/Transport/MandrillHttpTransportTest.php | 2 +- .../Mailchimp/Transport/MandrillHttpTransport.php | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php index dd2851154e..cfdc30bb78 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillHttpTransportTest.php @@ -57,7 +57,7 @@ class MandrillHttpTransportTest extends TestCase $body = json_decode($options['body'], true); $message = $body['raw_message']; $this->assertSame('KEY', $body['key']); - $this->assertSame('Saif Eddin ', $body['to'][0]); + $this->assertSame('saif.gmati@symfony.com', $body['to'][0]); $this->assertSame('Fabien ', $body['from_email']); $this->assertStringContainsString('Subject: Hello!', $message); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php index 09e728862c..6ead154906 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php @@ -47,7 +47,9 @@ class MandrillHttpTransport extends AbstractHttpTransport $response = $this->client->request('POST', 'https://'.$this->getEndpoint().'/api/1.0/messages/send-raw.json', [ 'json' => [ 'key' => $this->key, - 'to' => $this->getRecipients($envelope->getRecipients()), + 'to' => array_map(function (Address $recipient): string { + return $recipient->getAddress(); + }, $envelope->getRecipients()), 'from_email' => $envelope->getSender()->toString(), 'raw_message' => $message->toString(), ], @@ -71,14 +73,4 @@ class MandrillHttpTransport extends AbstractHttpTransport { return ($this->host ?: self::HOST).($this->port ? ':'.$this->port : ''); } - - /** - * @return string[] - */ - private function getRecipients(Envelope $envelope): array - { - return array_map(function (Address $recipient): string { - return $recipient->getAddress(); - }, $envelope->getRecipients()); - } }