File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/Symfony/Component/Mime Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ public function __construct(array $map = [])
5151 $ this ->extensions [$ mimeType ] = $ extensions ;
5252
5353 foreach ($ extensions as $ extension ) {
54- $ this ->mimeTypes [$ extension ] = $ mimeType ;
54+ $ this ->mimeTypes [$ extension ] = $ this ->mimeTypes [$ extension ] ?? [];
55+ $ this ->mimeTypes [$ extension ][] = $ mimeType ;
5556 }
5657 }
5758 $ this ->registerGuesser (new FileBinaryMimeTypeGuesser ());
Original file line number Diff line number Diff line change @@ -62,4 +62,15 @@ public function testGetMimeTypes()
6262 $ this ->assertContains ('image/svg ' , $ mt ->getMimeTypes ('svg ' ));
6363 $ this ->assertSame ([], $ mt ->getMimeTypes ('symfony ' ));
6464 }
65+
66+ public function testCustomMimeTypes ()
67+ {
68+ $ mt = new MimeTypes ([
69+ 'text/bar ' => 'foo ' ,
70+ 'text/baz ' => ['foo ' , 'moof ' ],
71+ ]);
72+ $ this ->assertContains ('text/bar ' , $ mt ->getMimeTypes ('foo ' ));
73+ $ this ->assertContains ('text/baz ' , $ mt ->getMimeTypes ('foo ' ));
74+ $ this ->assertSame (['foo ' , 'moof ' ], $ mt ->getExtensions ('text/baz ' ));
75+ }
6576}
You can’t perform that action at this time.
0 commit comments