Skip to content

Commit 054e7c2

Browse files
Merge branch '6.4' into 7.0
* 6.4: (33 commits) [Console][FrameworkBundle][HttpKernel][WebProfilerBundle] Enable profiling commands [AssetMapper] Disable profiler when the "dev server" respond Adds translations for Portuguese (pt) [AssetMapper] Link needs as="style" Allow Symfony 7.0 on Phrase translation provider [Mime] Throw InvalidArgumentException on invalid form field type inside array [Mailer][Bridges] Allow Symfony 7 [Tests] Use `JsonMockResponse` where applicable [FrameworkBundle][HttpKernel] Introduce `$buildDir` argument to `WarmableInterface::warmup` to warm read-only artefacts in `build_dir` [ErrorHandler] Fix expected missing return types [Form] Fix merging params & files when "multiple" is enabled [HttpFoundation] Do not swallow trailing `=` in cookie value Fix markdown in README files Handle Sendinblue error responses without a message key Handle Brevo error responses without a message key [Scheduler] Add failureEvent [Notifier][Bridges] Allow Symfony 7 [Mailer][Brevo][Sendinblue] Fix typo [Serializer] Fix collecting only first missing constructor argument [ErrorHandler] Fix file link format call in trace view ...
2 parents 6509ef5 + 3735cbd commit 054e7c2

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

Tests/Transport/MailgunApiTransportTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpClient\MockHttpClient;
16+
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1617
use Symfony\Component\HttpClient\Response\MockResponse;
1718
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunApiTransport;
1819
use Symfony\Component\Mailer\Envelope;
@@ -135,7 +136,7 @@ public function testSend()
135136
$this->assertStringContainsString('"Fabien" <[email protected]>', $content);
136137
$this->assertStringContainsString('Hello There!', $content);
137138

138-
return new MockResponse(json_encode(['id' => 'foobar']), [
139+
return new JsonMockResponse(['id' => 'foobar'], [
139140
'http_code' => 200,
140141
]);
141142
});
@@ -164,7 +165,7 @@ public function testSendWithMultipleTagHeaders()
164165
$this->assertStringContainsString("Content-Disposition: form-data; name=\"o:tag\"\r\n\r\npassword-reset\r\n", $content);
165166
$this->assertStringContainsString("Content-Disposition: form-data; name=\"o:tag\"\r\n\r\nproduct-name\r\n", $content);
166167

167-
return new MockResponse(json_encode(['id' => 'foobar2']), [
168+
return new JsonMockResponse(['id' => 'foobar2'], [
168169
'http_code' => 200,
169170
]);
170171
});
@@ -192,11 +193,8 @@ public function testSendThrowsForErrorResponse()
192193
$this->assertSame('https://api.mailgun.net:8984/v3/symfony/messages', $url);
193194
$this->assertStringContainsStringIgnoringCase('Authorization: Basic YXBpOkFDQ0VTU19LRVk=', $options['headers'][2] ?? $options['request_headers'][1]);
194195

195-
return new MockResponse(json_encode(['message' => 'i\'m a teapot']), [
196+
return new JsonMockResponse(['message' => 'i\'m a teapot'], [
196197
'http_code' => 418,
197-
'response_headers' => [
198-
'content-type' => 'application/json',
199-
],
200198
]);
201199
});
202200
$transport = new MailgunApiTransport('ACCESS_KEY', 'symfony', 'us', $client);

Tests/Transport/MailgunHttpTransportTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpClient\MockHttpClient;
16-
use Symfony\Component\HttpClient\Response\MockResponse;
16+
use Symfony\Component\HttpClient\Response\JsonMockResponse;
1717
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunHttpTransport;
1818
use Symfony\Component\Mailer\Exception\HttpTransportException;
1919
use Symfony\Component\Mailer\Header\MetadataHeader;
@@ -71,7 +71,7 @@ public function testSend()
7171
$this->assertStringContainsString('From: Fabien <[email protected]>', $content);
7272
$this->assertStringContainsString('Hello There!', $content);
7373

74-
return new MockResponse(json_encode(['id' => 'foobar']), [
74+
return new JsonMockResponse(['id' => 'foobar'], [
7575
'http_code' => 200,
7676
]);
7777
});
@@ -96,11 +96,8 @@ public function testSendThrowsForErrorResponse()
9696
$this->assertSame('https://api.mailgun.net:8984/v3/symfony/messages.mime', $url);
9797
$this->assertStringContainsString('Basic YXBpOkFDQ0VTU19LRVk=', $options['headers'][2] ?? $options['request_headers'][1]);
9898

99-
return new MockResponse(json_encode(['message' => 'i\'m a teapot']), [
99+
return new JsonMockResponse(['message' => 'i\'m a teapot'], [
100100
'http_code' => 418,
101-
'response_headers' => [
102-
'content-type' => 'application/json',
103-
],
104101
]);
105102
});
106103
$transport = new MailgunHttpTransport('ACCESS_KEY', 'symfony', 'us', $client);

0 commit comments

Comments
 (0)