Skip to content

Commit

Permalink
Merge branch '6.3' into 6.4
Browse files Browse the repository at this point in the history
* 6.3:
  Sync .github/expected-missing-return-types.diff
  [FrameworkBundle] Add void return-type to ErrorLoggerCompilerPass
  [DoctrineBridge] Fix cross-versions compat
  [HttpKernel] Handle nullable callback of StreamedResponse
  [Mailer] Capitalize sender header for Mailgun
  [FrameworkBundle] Configure `logger` as error logger if the Monolog Bundle is not registered
  DX: PHP CS Fixer - drop explicit nullable_type_declaration_for_default_null_value config, as it's part of ruleset anyway
  DX: PHP CS Fixer - drop explicit no_superfluous_phpdoc_tags config, as it's part of ruleset already
  Revert "Add keyword `dev` to leverage composer hint"
  [Validator] Add missing Ukrainian translations #51960
  [Validator] Add missing translations for Indonesian (id)
  [Validator] Add missing translations for Vietnamese (VI)
  Add missing Validator translations - Croatian (hr)
  Run high-deps tests with ORM 3 and DBAL 4
  [FrameworkBundle] Fix calling Kernel::warmUp() when running cache:warmup
  • Loading branch information
nicolas-grekas committed Oct 12, 2023
2 parents e8d52e1 + 8d97414 commit 0a149fa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Tests/Transport/MailgunApiTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testCustomHeader()

$email = new Email();
$envelope = new Envelope(new Address('alice@system.com'), [new Address('bob@system.com')]);
$email->getHeaders()->addTextHeader('h:sender', $envelope->getSender()->toString());
$email->getHeaders()->addTextHeader('h:Sender', $envelope->getSender()->toString());
$email->getHeaders()->addTextHeader('h:X-Mailgun-Variables', $json);
$email->getHeaders()->addTextHeader('h:foo', 'foo-value');
$email->getHeaders()->addTextHeader('t:text', 'text-value');
Expand All @@ -79,8 +79,8 @@ public function testCustomHeader()
$this->assertArrayHasKey('h:X-Mailgun-Variables', $payload);
$this->assertEquals($json, $payload['h:X-Mailgun-Variables']);

$this->assertArrayHasKey('h:sender', $payload);
$this->assertEquals($envelope->getSender()->toString(), $payload['h:sender']);
$this->assertArrayHasKey('h:Sender', $payload);
$this->assertEquals($envelope->getSender()->toString(), $payload['h:Sender']);
$this->assertArrayHasKey('h:foo', $payload);
$this->assertEquals('foo-value', $payload['h:foo']);
$this->assertArrayHasKey('t:text', $payload);
Expand Down
12 changes: 2 additions & 10 deletions Tests/Transport/MailgunHttpTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public function testSend()
$this->assertStringContainsString('Subject: Hello!', $content);
$this->assertStringContainsString('To: Saif Eddin <saif.gmati@symfony.com>', $content);
$this->assertStringContainsString('From: Fabien <fabpot@symfony.com>', $content);
$this->assertStringContainsString('Sender: Senior Fabien Eddin <fabpot@symfony.com>', $content);
$this->assertStringContainsString('h:sender: "Senior Fabien Eddin" <fabpot@symfony.com>', $content);
$this->assertStringContainsString('Hello There!', $content);

return new MockResponse(json_encode(['id' => 'foobar']), [
Expand All @@ -81,17 +79,11 @@ public function testSend()
$transport->setPort(8984);

$mail = new Email();
$toAddress = new Address('saif.gmati@symfony.com', 'Saif Eddin');
$fromAddress = new Address('fabpot@symfony.com', 'Fabien');
$senderAddress = new Address('fabpot@symfony.com', 'Senior Fabien Eddin');
$mail->subject('Hello!')
->to($toAddress)
->from($fromAddress)
->sender($senderAddress)
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
->from(new Address('fabpot@symfony.com', 'Fabien'))
->text('Hello There!');

$mail->getHeaders()->addHeader('h:sender', $mail->getSender()->toString());

$message = $transport->send($mail);

$this->assertSame('foobar', $message->getMessageId());
Expand Down
2 changes: 1 addition & 1 deletion Transport/MailgunApiTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
private function getPayload(Email $email, Envelope $envelope): array
{
$headers = $email->getHeaders();
$headers->addHeader('h:sender', $envelope->getSender()->toString());
$headers->addHeader('h:Sender', $envelope->getSender()->toString());
$html = $email->getHtmlBody();
if (null !== $html && \is_resource($html)) {
if (stream_get_meta_data($html)['seekable'] ?? false) {
Expand Down
1 change: 0 additions & 1 deletion Transport/MailgunHttpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function __toString(): string
protected function doSendHttp(SentMessage $message): ResponseInterface
{
$body = new FormDataPart([
'h:sender' => $message->getEnvelope()->getSender()->toString(),
'to' => implode(',', $this->stringifyAddresses($message->getEnvelope()->getRecipients())),
'message' => new DataPart($message->toString(), 'message.mime'),
]);
Expand Down

0 comments on commit 0a149fa

Please sign in to comment.