@@ -165,13 +165,14 @@ public function testEmbedPath(): void
165165 $ cid = $ this ->message ->embed ($ path );
166166
167167 $ this ->assertStringStartsWith ('cid: ' , $ cid );
168- $ name = Str::after ($ cid , 'cid: ' );
168+ $ contentId = Str::after ($ cid , 'cid: ' );
169169 $ attachment = $ this ->message ->getSymfonyMessage ()->getAttachments ()[0 ];
170170 $ headers = $ attachment ->getPreparedHeaders ()->toArray ();
171171 $ this ->assertSame ('bar ' , $ attachment ->getBody ());
172- $ this ->assertSame ("Content-Type: image/jpeg; name= {$ name }" , $ headers [0 ]);
172+ $ this ->assertSame ($ contentId , $ attachment ->getContentId ());
173+ $ this ->assertStringContainsString ('Content-Type: image/jpeg ' , $ headers [0 ]);
173174 $ this ->assertSame ('Content-Transfer-Encoding: base64 ' , $ headers [1 ]);
174- $ this ->assertSame ( " Content-Disposition: inline; name= { $ name } ; filename= { $ name }" , $ headers [2 ]);
175+ $ this ->assertStringContainsString ( ' Content-Disposition: inline ' , $ headers [2 ]);
175176
176177 unlink ($ path );
177178 }
@@ -182,7 +183,9 @@ public function testDataEmbed(): void
182183
183184 $ attachment = $ this ->message ->getSymfonyMessage ()->getAttachments ()[0 ];
184185 $ headers = $ attachment ->getPreparedHeaders ()->toArray ();
185- $ this ->assertSame ('cid:foo.jpg ' , $ cid );
186+ $ this ->assertStringStartsWith ('cid: ' , $ cid );
187+ $ contentId = Str::after ($ cid , 'cid: ' );
188+ $ this ->assertSame ($ contentId , $ attachment ->getContentId ());
186189 $ this ->assertSame ('bar ' , $ attachment ->getBody ());
187190 $ this ->assertSame ('Content-Type: image/png; name=foo.jpg ' , $ headers [0 ]);
188191 $ this ->assertSame ('Content-Transfer-Encoding: base64 ' , $ headers [1 ]);
@@ -201,9 +204,11 @@ public function toMailAttachment()
201204 }
202205 });
203206
204- $ this ->assertSame ('cid:baz ' , $ cid );
207+ $ this ->assertStringStartsWith ('cid: ' , $ cid );
208+ $ contentId = Str::after ($ cid , 'cid: ' );
205209 $ attachment = $ this ->message ->getSymfonyMessage ()->getAttachments ()[0 ];
206210 $ headers = $ attachment ->getPreparedHeaders ()->toArray ();
211+ $ this ->assertSame ($ contentId , $ attachment ->getContentId ());
207212 $ this ->assertSame ('bar ' , $ attachment ->getBody ());
208213 $ this ->assertSame ('Content-Type: image/png; name=baz ' , $ headers [0 ]);
209214 $ this ->assertSame ('Content-Transfer-Encoding: base64 ' , $ headers [1 ]);
@@ -225,14 +230,14 @@ public function toMailAttachment()
225230 });
226231
227232 $ this ->assertStringStartsWith ('cid: ' , $ cid );
228- $ name = Str::after ($ cid , 'cid: ' );
229- $ this ->assertSame (16 , mb_strlen ($ name ));
233+ $ contentId = Str::after ($ cid , 'cid: ' );
230234 $ attachment = $ this ->message ->getSymfonyMessage ()->getAttachments ()[0 ];
235+ $ this ->assertSame ($ contentId , $ attachment ->getContentId ());
231236 $ headers = $ attachment ->getPreparedHeaders ()->toArray ();
232237 $ this ->assertSame ('bar ' , $ attachment ->getBody ());
233- $ this ->assertSame ( " Content-Type: image/jpeg; name= { $ name }" , $ headers [0 ]);
238+ $ this ->assertStringContainsString ( ' Content-Type: image/jpeg ' , $ headers [0 ]);
234239 $ this ->assertSame ('Content-Transfer-Encoding: base64 ' , $ headers [1 ]);
235- $ this ->assertSame ( " Content-Disposition: inline; name= { $ name } ; \r\n filename= { $ name }" , $ headers [2 ]);
240+ $ this ->assertStringContainsString ( ' Content-Disposition: inline ' , $ headers [2 ]);
236241
237242 unlink ($ path );
238243 }
0 commit comments