[Mailer] fix typos

This commit is contained in:
Nicolas Grekas 2020-02-04 20:55:13 +01:00
parent 5ae1384e8f
commit 88b4579942
2 changed files with 4 additions and 12 deletions

View File

@ -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 <saif.gmati@symfony.com>', $body['to'][0]);
$this->assertSame('saif.gmati@symfony.com', $body['to'][0]);
$this->assertSame('Fabien <fabpot@symfony.com>', $body['from_email']);
$this->assertStringContainsString('Subject: Hello!', $message);

View File

@ -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());
}
}