File tree 2 files changed +13
-1
lines changed
src/Symfony/Component/Mime
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 = [])
51
51
$ this ->extensions [$ mimeType ] = $ extensions ;
52
52
53
53
foreach ($ extensions as $ extension ) {
54
- $ this ->mimeTypes [$ extension ] = $ mimeType ;
54
+ $ this ->mimeTypes [$ extension ] = $ this ->mimeTypes [$ extension ] ?? [];
55
+ $ this ->mimeTypes [$ extension ][] = $ mimeType ;
55
56
}
56
57
}
57
58
$ this ->registerGuesser (new FileBinaryMimeTypeGuesser ());
Original file line number Diff line number Diff line change @@ -62,4 +62,15 @@ public function testGetMimeTypes()
62
62
$ this ->assertContains ('image/svg ' , $ mt ->getMimeTypes ('svg ' ));
63
63
$ this ->assertSame ([], $ mt ->getMimeTypes ('symfony ' ));
64
64
}
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
+ }
65
76
}
You can’t perform that action at this time.
0 commit comments