@@ -252,12 +252,19 @@ public function testRunToolsEmailMessageClassString() {
252252 * @return void
253253 */
254254 public function testRunWithAttachments () {
255+ // Create temporary files for testing
256+ $ tmpFile1 = tempnam (sys_get_temp_dir (), 'test_file1_ ' ) . '.txt ' ;
257+ $ tmpFile2 = tempnam (sys_get_temp_dir (), 'test_file2_ ' ) . '.pdf ' ;
258+
259+ file_put_contents ($ tmpFile1 , 'Test content for file 1 ' );
260+ file_put_contents ($ tmpFile2 , 'Test content for file 2 ' );
261+
255262 $ attachments = [
256263 'file1.txt ' => [
257- 'file ' => ' /tmp/file1.txt ' ,
264+ 'file ' => $ tmpFile1 ,
258265 'mimetype ' => 'text/plain ' ,
259266 ],
260- 'file2.pdf ' => ' /tmp/file2.pdf ' ,
267+ 'file2.pdf ' => $ tmpFile2 ,
261268 ];
262269
263270 $ settings = [
@@ -280,9 +287,14 @@ public function testRunWithAttachments() {
280287 $ this ->assertCount (2 , $ mailerAttachments );
281288 $ this ->assertArrayHasKey ('file1.txt ' , $ mailerAttachments );
282289 $ this ->assertArrayHasKey ('file2.pdf ' , $ mailerAttachments );
283- $ this ->assertSame (' /tmp/file1.txt ' , $ mailerAttachments ['file1.txt ' ]['file ' ]);
290+ $ this ->assertSame ($ tmpFile1 , $ mailerAttachments ['file1.txt ' ]['file ' ]);
284291 $ this ->assertSame ('text/plain ' , $ mailerAttachments ['file1.txt ' ]['mimetype ' ]);
285- $ this ->assertSame ('/tmp/file2.pdf ' , $ mailerAttachments ['file2.pdf ' ]);
292+ $ this ->assertSame ($ tmpFile2 , $ mailerAttachments ['file2.pdf ' ]['file ' ]);
293+ $ this ->assertSame ('application/pdf ' , $ mailerAttachments ['file2.pdf ' ]['mimetype ' ]);
294+
295+ // Clean up temporary files
296+ unlink ($ tmpFile1 );
297+ unlink ($ tmpFile2 );
286298 }
287299
288300 /**
0 commit comments