File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/Symfony/Component/Mime Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -479,7 +479,7 @@ private function prepareParts(): ?array
479479 ];
480480 $ tmpMatches = [];
481481 foreach ($ regexes as $ regex ) {
482- preg_match_all ('/ ' . $ regex . '/i ' , $ html , $ tmpMatches );
482+ preg_match_all ('/ ' . $ regex. '/i ' , $ html , $ tmpMatches );
483483 $ names = array_merge ($ names , $ tmpMatches [2 ], $ tmpMatches [3 ]);
484484 }
485485 $ names = array_filter (array_unique ($ names ));
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ public function testGenerateBody()
329329 $ generatedHtml = $ parts [0 ]->getParts ()[1 ];
330330 $ this ->assertStringContainsString ('cid: ' .$ parts [1 ]->getContentId (), $ generatedHtml ->getBody ());
331331
332- $ content = '<div background ="cid:test.gif"></div > ' ;
332+ $ content = 'html content <img src ="cid:test.gif"> ' ;
333333 $ r = fopen ('php://memory ' , 'r+ ' , false );
334334 fwrite ($ r , $ content );
335335 rewind ($ r );
@@ -343,6 +343,14 @@ public function testGenerateBody()
343343 $ this ->assertInstanceOf (RelatedPart::class, $ body );
344344 // 2 parts only, not 3 (text + embedded image once)
345345 $ this ->assertCount (2 , $ parts = $ body ->getParts ());
346+ $ this ->assertStringMatchesFormat ('html content <img src=3D"cid:%s@symfony"> ' , $ parts [0 ]->bodyToString ());
347+
348+ $ e = (new Email ())->from ('me@example.com ' )->to ('you@example.com ' );
349+ $ e ->html ('<div background="cid:test.gif"></div> ' );
350+ $ e ->embed ($ image , 'test.gif ' );
351+ $ body = $ e ->getBody ();
352+ $ this ->assertInstanceOf (RelatedPart::class, $ body );
353+ $ this ->assertCount (2 , $ parts = $ body ->getParts ());
346354 $ this ->assertStringMatchesFormat ('<div background=3D"cid:%s@symfony"></div> ' , $ parts [0 ]->bodyToString ());
347355 }
348356
You can’t perform that action at this time.
0 commit comments