@@ -138,32 +138,35 @@ public function testFromPathWithNotAFile()
138
138
139
139
public function testFromPathWithUrl ()
140
140
{
141
- if (!\in_array ('https ' , stream_get_wrappers ())) {
142
- $ this ->markTestSkipped ('"https " stream wrapper is not enabled. ' );
141
+ if (!\in_array ('http ' , stream_get_wrappers ())) {
142
+ $ this ->markTestSkipped ('"http " stream wrapper is not enabled. ' );
143
143
}
144
144
145
145
$ finder = new PhpExecutableFinder ();
146
146
$ process = new Process (array_merge ([$ finder ->find (false )], $ finder ->findArguments (), ['-dopcache.enable=0 ' , '-dvariables_order=EGPCS ' , '-S ' , '127.0.0.1:8057 ' ]));
147
147
$ process ->setWorkingDirectory (__DIR__ .'/../Fixtures/web ' );
148
148
$ process ->start ();
149
149
150
- do {
151
- usleep (50000 );
152
- } while (!@fopen ('http://127.0.0.1:8057 ' , 'r ' ));
153
-
154
- $ p = DataPart::fromPath ($ file = 'http://localhost:8057/logo_symfony_header.png ' );
155
- $ content = file_get_contents ($ file );
156
- $ this ->assertEquals ($ content , $ p ->getBody ());
157
- $ maxLineLength = 76 ;
158
- $ this ->assertEquals (substr (base64_encode ($ content ), 0 , $ maxLineLength ), substr ($ p ->bodyToString (), 0 , $ maxLineLength ));
159
- $ this ->assertEquals (substr (base64_encode ($ content ), 0 , $ maxLineLength ), substr (implode ('' , iterator_to_array ($ p ->bodyToIterable ())), 0 , $ maxLineLength ));
160
- $ this ->assertEquals ('image ' , $ p ->getMediaType ());
161
- $ this ->assertEquals ('png ' , $ p ->getMediaSubType ());
162
- $ this ->assertEquals (new Headers (
163
- new ParameterizedHeader ('Content-Type ' , 'image/png ' , ['name ' => 'logo_symfony_header.png ' ]),
164
- new UnstructuredHeader ('Content-Transfer-Encoding ' , 'base64 ' ),
165
- new ParameterizedHeader ('Content-Disposition ' , 'attachment ' , ['name ' => 'logo_symfony_header.png ' , 'filename ' => 'logo_symfony_header.png ' ])
166
- ), $ p ->getPreparedHeaders ());
150
+ try {
151
+ do {
152
+ usleep (50000 );
153
+ } while (!@fopen ('http://127.0.0.1:8057 ' , 'r ' ));
154
+ $ p = DataPart::fromPath ($ file = 'http://localhost:8057/logo_symfony_header.png ' );
155
+ $ content = file_get_contents ($ file );
156
+ $ this ->assertEquals ($ content , $ p ->getBody ());
157
+ $ maxLineLength = 76 ;
158
+ $ this ->assertEquals (substr (base64_encode ($ content ), 0 , $ maxLineLength ), substr ($ p ->bodyToString (), 0 , $ maxLineLength ));
159
+ $ this ->assertEquals (substr (base64_encode ($ content ), 0 , $ maxLineLength ), substr (implode ('' , iterator_to_array ($ p ->bodyToIterable ())), 0 , $ maxLineLength ));
160
+ $ this ->assertEquals ('image ' , $ p ->getMediaType ());
161
+ $ this ->assertEquals ('png ' , $ p ->getMediaSubType ());
162
+ $ this ->assertEquals (new Headers (
163
+ new ParameterizedHeader ('Content-Type ' , 'image/png ' , ['name ' => 'logo_symfony_header.png ' ]),
164
+ new UnstructuredHeader ('Content-Transfer-Encoding ' , 'base64 ' ),
165
+ new ParameterizedHeader ('Content-Disposition ' , 'attachment ' , ['name ' => 'logo_symfony_header.png ' , 'filename ' => 'logo_symfony_header.png ' ])
166
+ ), $ p ->getPreparedHeaders ());
167
+ } finally {
168
+ $ process ->stop ();
169
+ }
167
170
}
168
171
169
172
public function testHasContentId ()
0 commit comments