Skip to content

Commit

Permalink
Merge branch '4.4' into 5.0
Browse files Browse the repository at this point in the history
* 4.4: (26 commits)
  [HttpClient] NativeHttpClient should not send >1.1 protocol version
  [HttpClient] fix support for non-blocking resource streams
  [Mailer] Make sure you can pass custom headers to Mailgun
  [Mailer] Remove line breaks in email attachment content
  Update links to documentation
  [Validator] Add the missing translations for the Arabic (ar) locale
  ensure to expect no validation for the right reasons
  [Security-Guard] fixed 35203 missing name tag in param docblock
  [HttpClient] fix casting responses to PHP streams
  [PhpUnitBridge] Add test case for @expectedDeprecation annotation
  [PhpUnitBridge][SymfonyTestsListenerTrait] Remove $testsWithWarnings stack
  [Mailer] Fix addresses management in Sendgrid API payload
  [Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API
  [Mailer][MailchimpBridge] Fix incorrect sender address when sender has name
  [HttpClient] fix capturing SSL certificates with NativeHttpClient
  Update year in license files
  [TwigBridge][Form] Added missing help messages in form themes
  Update year in license files
  Update year in license files
  fix version when "anonymous: lazy" was introduced
  ...
  • Loading branch information
nicolas-grekas committed Jan 4, 2020
2 parents 788b60b + d8e9a51 commit a5d8e6e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 Fabien Potencier
Copyright (c) 2019-2020 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 20 additions & 0 deletions Tests/Transport/PostmarkApiTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport;
use Symfony\Component\Mailer\Envelope;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;

class PostmarkApiTransportTest extends TestCase
{
Expand Down Expand Up @@ -41,4 +44,21 @@ public function getTransportData()
],
];
}

public function testCustomHeader()
{
$email = new Email();
$email->getHeaders()->addTextHeader('foo', 'bar');
$envelope = new Envelope(new Address('alice@system.com'), [new Address('bob@system.com')]);

$transport = new PostmarkApiTransport('ACCESS_KEY');
$method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload');
$method->setAccessible(true);
$payload = $method->invoke($transport, $email, $envelope);

$this->assertArrayHasKey('Headers', $payload);
$this->assertCount(1, $payload['Headers']);

$this->assertEquals(['Name' => 'foo', 'Value' => 'bar'], $payload['Headers'][0]);
}
}
2 changes: 1 addition & 1 deletion Transport/PostmarkApiTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function getPayload(Email $email, Envelope $envelope): array

$payload['Headers'][] = [
'Name' => $name,
'Value' => $header->toString(),
'Value' => $header->getBodyAsString(),
];
}

Expand Down

0 comments on commit a5d8e6e

Please sign in to comment.