@@ -199,12 +199,11 @@ public function testRequestFromGlobalsWithConnectProxyOverHttps(): void
199
199
$ this ->assertEquals ('example.com:443 ' , $ request ->getHeaderLine ('Host ' ));
200
200
}
201
201
202
+ /**
203
+ * @runInSeparateProcess
204
+ */
202
205
public function testSendResponseSendsEmptyResponseWithNoHeadersAndEmptyBodyAndAssignsNoContentTypeAndEmptyContentLength (): void
203
206
{
204
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
205
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
206
- }
207
-
208
207
header_remove ();
209
208
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
210
209
$ sapi = new SapiHandler ();
@@ -213,15 +212,18 @@ public function testSendResponseSendsEmptyResponseWithNoHeadersAndEmptyBodyAndAs
213
212
$ this ->expectOutputString ('' );
214
213
$ sapi ->sendResponse ($ response );
215
214
215
+ if (!function_exists ('xdebug_get_headers ' )) {
216
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
217
+ return ;
218
+ }
216
219
$ this ->assertEquals (['Content-Type: ' , 'Content-Length: 0 ' ], xdebug_get_headers ());
217
220
}
218
221
222
+ /**
223
+ * @runInSeparateProcess
224
+ */
219
225
public function testSendResponseSendsJsonResponseWithGivenHeadersAndBodyAndAssignsMatchingContentLength (): void
220
226
{
221
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
222
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
223
- }
224
-
225
227
header_remove ();
226
228
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
227
229
$ sapi = new SapiHandler ();
@@ -230,18 +232,18 @@ public function testSendResponseSendsJsonResponseWithGivenHeadersAndBodyAndAssig
230
232
$ this ->expectOutputString ('{} ' );
231
233
$ sapi ->sendResponse ($ response );
232
234
235
+ if (!function_exists ('xdebug_get_headers ' )) {
236
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
237
+ return ;
238
+ }
233
239
$ this ->assertEquals (['Content-Type: application/json ' , 'Content-Length: 2 ' ], xdebug_get_headers ());
234
240
}
235
241
236
242
/**
237
- * @backupGlobals enabled
243
+ * @runInSeparateProcess
238
244
*/
239
245
public function testSendResponseSendsJsonResponseWithGivenHeadersAndMatchingContentLengthButEmptyBodyForHeadRequest (): void
240
246
{
241
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
242
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
243
- }
244
-
245
247
header_remove ();
246
248
$ _SERVER ['REQUEST_METHOD ' ] = 'HEAD ' ;
247
249
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
@@ -251,15 +253,18 @@ public function testSendResponseSendsJsonResponseWithGivenHeadersAndMatchingCont
251
253
$ this ->expectOutputString ('' );
252
254
$ sapi ->sendResponse ($ response );
253
255
256
+ if (!function_exists ('xdebug_get_headers ' )) {
257
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
258
+ return ;
259
+ }
254
260
$ this ->assertEquals (['Content-Type: application/json ' , 'Content-Length: 2 ' ], xdebug_get_headers ());
255
261
}
256
262
263
+ /**
264
+ * @runInSeparateProcess
265
+ */
257
266
public function testSendResponseSendsEmptyBodyWithGivenHeadersAndAssignsNoContentLengthForNoContentResponse (): void
258
267
{
259
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
260
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
261
- }
262
-
263
268
header_remove ();
264
269
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
265
270
$ sapi = new SapiHandler ();
@@ -268,15 +273,18 @@ public function testSendResponseSendsEmptyBodyWithGivenHeadersAndAssignsNoConten
268
273
$ this ->expectOutputString ('' );
269
274
$ sapi ->sendResponse ($ response );
270
275
276
+ if (!function_exists ('xdebug_get_headers ' )) {
277
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
278
+ return ;
279
+ }
271
280
$ this ->assertEquals (['Content-Type: application/json ' ], xdebug_get_headers ());
272
281
}
273
282
283
+ /**
284
+ * @runInSeparateProcess
285
+ */
274
286
public function testSendResponseSendsEmptyBodyWithGivenHeadersButWithoutExplicitContentLengthForNoContentResponse (): void
275
287
{
276
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
277
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
278
- }
279
-
280
288
header_remove ();
281
289
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
282
290
$ sapi = new SapiHandler ();
@@ -285,15 +293,18 @@ public function testSendResponseSendsEmptyBodyWithGivenHeadersButWithoutExplicit
285
293
$ this ->expectOutputString ('' );
286
294
$ sapi ->sendResponse ($ response );
287
295
296
+ if (!function_exists ('xdebug_get_headers ' )) {
297
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
298
+ return ;
299
+ }
288
300
$ this ->assertEquals (['Content-Type: application/json ' ], xdebug_get_headers ());
289
301
}
290
302
303
+ /**
304
+ * @runInSeparateProcess
305
+ */
291
306
public function testSendResponseSendsEmptyBodyWithGivenHeadersAndAssignsContentLengthForNotModifiedResponse (): void
292
307
{
293
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
294
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
295
- }
296
-
297
308
header_remove ();
298
309
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
299
310
$ sapi = new SapiHandler ();
@@ -302,15 +313,18 @@ public function testSendResponseSendsEmptyBodyWithGivenHeadersAndAssignsContentL
302
313
$ this ->expectOutputString ('' );
303
314
$ sapi ->sendResponse ($ response );
304
315
316
+ if (!function_exists ('xdebug_get_headers ' )) {
317
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
318
+ return ;
319
+ }
305
320
$ this ->assertEquals (['Content-Type: application/json ' , 'Content-Length: 4 ' ], xdebug_get_headers ());
306
321
}
307
322
323
+ /**
324
+ * @runInSeparateProcess
325
+ */
308
326
public function testSendResponseSendsEmptyBodyWithGivenHeadersAndExplicitContentLengthForNotModifiedResponse (): void
309
327
{
310
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
311
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
312
- }
313
-
314
328
header_remove ();
315
329
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
316
330
$ sapi = new SapiHandler ();
@@ -319,15 +333,18 @@ public function testSendResponseSendsEmptyBodyWithGivenHeadersAndExplicitContent
319
333
$ this ->expectOutputString ('' );
320
334
$ sapi ->sendResponse ($ response );
321
335
336
+ if (!function_exists ('xdebug_get_headers ' )) {
337
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
338
+ return ;
339
+ }
322
340
$ this ->assertEquals (['Content-Type: application/json ' , 'Content-Length: 2 ' ], xdebug_get_headers ());
323
341
}
324
342
343
+ /**
344
+ * @runInSeparateProcess
345
+ */
325
346
public function testSendResponseSendsStreamingResponseWithNoHeadersAndBodyFromStreamData (): void
326
347
{
327
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
328
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
329
- }
330
-
331
348
header_remove ();
332
349
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
333
350
$ sapi = new SapiHandler ();
@@ -337,20 +354,20 @@ public function testSendResponseSendsStreamingResponseWithNoHeadersAndBodyFromSt
337
354
$ this ->expectOutputString ('test ' );
338
355
$ sapi ->sendResponse ($ response );
339
356
340
- $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
341
-
342
357
$ body ->end ('test ' );
358
+
359
+ if (!function_exists ('xdebug_get_headers ' )) {
360
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
361
+ return ;
362
+ }
363
+ $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
343
364
}
344
365
345
366
/**
346
- * @backupGlobals enabled
367
+ * @runInSeparateProcess
347
368
*/
348
369
public function testSendResponseClosesStreamingResponseAndSendsResponseWithNoHeadersAndBodyForHeadRequest (): void
349
370
{
350
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
351
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
352
- }
353
-
354
371
header_remove ();
355
372
$ _SERVER ['REQUEST_METHOD ' ] = 'HEAD ' ;
356
373
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
@@ -361,16 +378,20 @@ public function testSendResponseClosesStreamingResponseAndSendsResponseWithNoHea
361
378
$ this ->expectOutputString ('' );
362
379
$ sapi ->sendResponse ($ response );
363
380
364
- $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
365
381
$ this ->assertFalse ($ body ->isReadable ());
382
+
383
+ if (!function_exists ('xdebug_get_headers ' )) {
384
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
385
+ return ;
386
+ }
387
+ $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
366
388
}
367
389
390
+ /**
391
+ * @runInSeparateProcess
392
+ */
368
393
public function testSendResponseClosesStreamingResponseAndSendsResponseWithNoHeadersAndBodyForNotModifiedResponse (): void
369
394
{
370
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
371
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
372
- }
373
-
374
395
header_remove ();
375
396
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
376
397
$ sapi = new SapiHandler ();
@@ -380,16 +401,20 @@ public function testSendResponseClosesStreamingResponseAndSendsResponseWithNoHea
380
401
$ this ->expectOutputString ('' );
381
402
$ sapi ->sendResponse ($ response );
382
403
383
- $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
384
404
$ this ->assertFalse ($ body ->isReadable ());
405
+
406
+ if (!function_exists ('xdebug_get_headers ' )) {
407
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
408
+ return ;
409
+ }
410
+ $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
385
411
}
386
412
413
+ /**
414
+ * @runInSeparateProcess
415
+ */
387
416
public function testSendResponseClosesStreamingResponseAndSendsResponseWithNoHeadersAndBodyForNoContentResponse (): void
388
417
{
389
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
390
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
391
- }
392
-
393
418
header_remove ();
394
419
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
395
420
$ sapi = new SapiHandler ();
@@ -399,16 +424,20 @@ public function testSendResponseClosesStreamingResponseAndSendsResponseWithNoHea
399
424
$ this ->expectOutputString ('' );
400
425
$ sapi ->sendResponse ($ response );
401
426
402
- $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
403
427
$ this ->assertFalse ($ body ->isReadable ());
428
+
429
+ if (!function_exists ('xdebug_get_headers ' )) {
430
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
431
+ return ;
432
+ }
433
+ $ this ->assertEquals (['Content-Type: ' ], xdebug_get_headers ());
404
434
}
405
435
436
+ /**
437
+ * @runInSeparateProcess
438
+ */
406
439
public function testSendResponseSendsStreamingResponseWithNoHeadersAndBodyFromStreamDataAndNoBufferHeaderForNginxServer (): void
407
440
{
408
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
409
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
410
- }
411
-
412
441
header_remove ();
413
442
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
414
443
$ _SERVER ['SERVER_SOFTWARE ' ] = 'nginx/1 ' ;
@@ -419,17 +448,20 @@ public function testSendResponseSendsStreamingResponseWithNoHeadersAndBodyFromSt
419
448
$ this ->expectOutputString ('test ' );
420
449
$ sapi ->sendResponse ($ response );
421
450
422
- $ this ->assertEquals (['Content-Type: ' , 'X-Accel-Buffering: no ' ], xdebug_get_headers ());
423
-
424
451
$ body ->end ('test ' );
452
+
453
+ if (!function_exists ('xdebug_get_headers ' )) {
454
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
455
+ return ;
456
+ }
457
+ $ this ->assertEquals (['Content-Type: ' , 'X-Accel-Buffering: no ' ], xdebug_get_headers ());
425
458
}
426
459
460
+ /**
461
+ * @runInSeparateProcess
462
+ */
427
463
public function testSendResponseSetsMultipleCookieHeaders (): void
428
464
{
429
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
430
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
431
- }
432
-
433
465
header_remove ();
434
466
$ _SERVER ['SERVER_PROTOCOL ' ] = 'http/1.1 ' ;
435
467
$ sapi = new SapiHandler ();
@@ -438,15 +470,18 @@ public function testSendResponseSetsMultipleCookieHeaders(): void
438
470
$ this ->expectOutputString ('' );
439
471
$ sapi ->sendResponse ($ response );
440
472
473
+ if (!function_exists ('xdebug_get_headers ' )) {
474
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
475
+ return ;
476
+ }
441
477
$ this ->assertEquals (['Content-Type: ' , 'Set-Cookie: 1=1 ' , 'Set-Cookie: 2=2 ' ], xdebug_get_headers ());
442
478
}
443
479
480
+ /**
481
+ * @runInSeparateProcess
482
+ */
444
483
public function testRunWillSendResponseHeadersFromHandler (): void
445
484
{
446
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
447
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
448
- }
449
-
450
485
$ sapi = new SapiHandler ();
451
486
452
487
header_remove ();
@@ -457,15 +492,18 @@ public function testRunWillSendResponseHeadersFromHandler(): void
457
492
return new Response ();
458
493
});
459
494
495
+ if (!function_exists ('xdebug_get_headers ' )) {
496
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
497
+ return ;
498
+ }
460
499
$ this ->assertEquals (['Content-Type: ' , 'Content-Length: 0 ' ], xdebug_get_headers ());
461
500
}
462
501
502
+ /**
503
+ * @runInSeparateProcess
504
+ */
463
505
public function testRunWillSendResponseHeadersFromDeferredHandler (): void
464
506
{
465
- if (headers_sent () || !function_exists ('xdebug_get_headers ' )) {
466
- $ this ->markTestSkipped ('Test requires running PHPUnit with Xdebug enabled ' );
467
- }
468
-
469
507
$ sapi = new SapiHandler ();
470
508
471
509
header_remove ();
@@ -476,6 +514,10 @@ public function testRunWillSendResponseHeadersFromDeferredHandler(): void
476
514
return resolve (new Response ());
477
515
});
478
516
517
+ if (!function_exists ('xdebug_get_headers ' )) {
518
+ // $this->markTestIncomplete('Testing headers requires running PHPUnit with Xdebug enabled');
519
+ return ;
520
+ }
479
521
$ this ->assertEquals (['Content-Type: ' , 'Content-Length: 0 ' ], xdebug_get_headers ());
480
522
}
481
523
}
0 commit comments