File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ public function testTimeoutIsNotAFatalError()
97
97
{
98
98
$ client = $ this ->getHttpClient (__FUNCTION__ );
99
99
$ response = $ client ->request ('GET ' , 'http://localhost:8057/timeout-body ' , [
100
- 'timeout ' => 0.1 ,
100
+ 'timeout ' => 0.3 ,
101
101
]);
102
102
103
103
try {
@@ -106,7 +106,16 @@ public function testTimeoutIsNotAFatalError()
106
106
} catch (TransportException $ e ) {
107
107
}
108
108
109
- usleep (400000 );
110
- $ this ->assertSame ('<1><2> ' , $ response ->getContent ());
109
+ for ($ i = 0 ; $ i < 10 ; ++$ i ) {
110
+ try {
111
+ $ this ->assertSame ('<1><2> ' , $ response ->getContent ());
112
+ break ;
113
+ } catch (TransportException $ e ) {
114
+ }
115
+ }
116
+
117
+ if (10 === $ i ) {
118
+ throw $ e ;
119
+ }
111
120
}
112
121
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ 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 ][] = $ mimeType ;
55
55
}
56
56
}
57
57
$ 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