@@ -241,6 +241,47 @@ public function testSendEmailWithAttachmentsShouldCalledInfobipWithTheRightParam
241
241
);
242
242
}
243
243
244
+ public function testSendEmailWithHeadersShouldCalledInfobipWithTheRightParameters ()
245
+ {
246
+ $ email = $ this ->basicValidEmail ();
247
+ $ email ->getHeaders ()
248
+ ->addTextHeader ('intermediateReport ' , 'true ' )
249
+ ->addTextHeader ('notifyUrl ' , 'https://foo.bar ' )
250
+ ->addTextHeader ('notifyContentType ' , 'application/json ' )
251
+ ->addTextHeader ('messageId ' , 'RANDOM-CUSTOM-ID ' );
252
+
253
+ $ this ->transport ->send ($ email );
254
+
255
+ $ options = $ this ->response ->getRequestOptions ();
256
+ $ this ->arrayHasKey ('body ' );
257
+ $ this ->assertStringMatchesFormat (<<<'TXT'
258
+ %a
259
+ --%s
260
+ Content-Type: text/plain; charset=utf-8
261
+ Content-Transfer-Encoding: 8bit
262
+ Content-Disposition: form-data; name="intermediateReport"
263
+ true
264
+ --%s
265
+ Content-Type: text/plain; charset=utf-8
266
+ Content-Transfer-Encoding: 8bit
267
+ Content-Disposition: form-data; name="notifyUrl"
268
+ https://foo.bar
269
+ --%s
270
+ Content-Type: text/plain; charset=utf-8
271
+ Content-Transfer-Encoding: 8bit
272
+ Content-Disposition: form-data; name="notifyContentType"
273
+ application/json
274
+ --%s
275
+ Content-Type: text/plain; charset=utf-8
276
+ Content-Transfer-Encoding: 8bit
277
+ Content-Disposition: form-data; name="messageId"
278
+ RANDOM-CUSTOM-ID
279
+ --%s--
280
+ TXT,
281
+ $ options ['body ' ]
282
+ );
283
+ }
284
+
244
285
public function testSendMinimalEmailWithSuccess ()
245
286
{
246
287
$ email = (new Email ())
@@ -357,6 +398,31 @@ public function testSendEmailWithAttachmentsWithSuccess()
357
398
);
358
399
}
359
400
401
+ public function testSendEmailWithHeadersWithSuccess ()
402
+ {
403
+ $ email = $ this ->basicValidEmail ();
404
+ $ email ->getHeaders ()
405
+ ->addTextHeader ('intermediateReport ' , 'true ' )
406
+ ->addTextHeader ('notifyUrl ' , 'https://foo.bar ' )
407
+ ->addTextHeader ('notifyContentType ' , 'application/json ' )
408
+ ->addTextHeader ('messageId ' , 'RANDOM-CUSTOM-ID ' );
409
+
410
+ $ sentMessage = $ this ->transport ->send ($ email );
411
+
412
+ $ this ->assertInstanceOf (SentMessage::class, $ sentMessage );
413
+ $ this ->assertStringMatchesFormat (
414
+ <<<'TXT'
415
+ %a
416
+ intermediateReport: true
417
+ notifyUrl: https://foo.bar
418
+ notifyContentType: application/json
419
+ messageId: RANDOM-CUSTOM-ID
420
+ %a
421
+ TXT,
422
+ $ sentMessage ->toString ()
423
+ );
424
+ }
425
+
360
426
public function testSentMessageShouldCaptureInfobipMessageId ()
361
427
{
362
428
$ this ->response = new MockResponse ('{"messages": [{"messageId": "somexternalMessageId0"}]} ' );
0 commit comments