diff --git a/test/PHPMailer/FilenameToTypeTest.php b/test/PHPMailer/FilenameToTypeTest.php index 23b7fdb3..8f12fc08 100644 --- a/test/PHPMailer/FilenameToTypeTest.php +++ b/test/PHPMailer/FilenameToTypeTest.php @@ -44,10 +44,26 @@ final class FilenameToTypeTest extends TestCase public function dataFilenameToType() { return [ + 'Empty string' => [ + 'filename' => '', + 'expected' => 'application/octet-stream', + ], + 'File name without query string' => [ + 'filename' => 'abc.png', + 'expected' => 'image/png', + ], 'File name with query string' => [ 'filename' => 'abc.jpg?xyz=1', 'expected' => 'image/jpeg', ], + 'Full path to file, linux style' => [ + 'filename' => '/usr/sbin/subdir/docs.pdf', + 'expected' => 'application/pdf', + ], + 'Full path to file, windows style' => [ + 'filename' => 'D:\subdir\with spaces\subdir\myapp.zip', + 'expected' => 'application/zip', + ], 'Unknown extension, should return default MIME type' => [ 'filename' => 'abc.xyzpdq', 'expected' => 'application/octet-stream',