File tree 2 files changed +5
-7
lines changed
src/Symfony/Component/Mime
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ public function getBody(): AbstractPart
424
424
private function generateBody (): AbstractPart
425
425
{
426
426
[$ htmlPart , $ attachmentParts , $ inlineParts ] = $ this ->prepareParts ();
427
- if (null === $ this ->text && null === $ this ->html && empty ( $ attachmentParts) ) {
427
+ if (null === $ this ->text && null === $ this ->html && ! $ attachmentParts ) {
428
428
throw new LogicException ('A message must have a text or an HTML part or attachments. ' );
429
429
}
430
430
Original file line number Diff line number Diff line change @@ -238,12 +238,6 @@ public function testGenerateBodyThrowsWhenEmptyBody()
238
238
(new Email ())->getBody ();
239
239
}
240
240
241
- public function testGenerateBodyDoesNotThrowWhenAttachmentsPresent ()
242
- {
243
- $ body = (new Email ())->attachFromPath (__FILE__ )->getBody ();
244
- $ this ->assertNotEmpty ($ body );
245
- }
246
-
247
241
public function testGetBody ()
248
242
{
249
243
$ e = new Email ();
@@ -290,6 +284,10 @@ public function testGenerateBody()
290
284
$ e ->html ('html content ' );
291
285
$ this ->assertEquals (new MixedPart ($ html , $ att ), $ e ->getBody ());
292
286
287
+ $ e = new Email ();
288
+ $ e ->attach ($ file );
289
+ $ this ->assertEquals (new MixedPart ($ att ), $ e ->getBody ());
290
+
293
291
$ e = new Email ();
294
292
$ e ->html ('html content ' );
295
293
$ e ->text ('text content ' );
You can’t perform that action at this time.
0 commit comments