22
33declare (strict_types=1 );
44
5+ namespace Spiral \RoadRunner \Tests \Http \Unit ;
6+
57use Nyholm \Psr7 \Factory \Psr17Factory ;
68use PHPUnit \Framework \Attributes \CoversClass ;
79use PHPUnit \Framework \Attributes \RunClassInSeparateProcess ;
1820#[RunClassInSeparateProcess]
1921final class PSR7WorkerTest extends TestCase
2022{
21- /***
22- * @param array $headers
23- */
2423 public function testStateServerLeak (): void
2524 {
2625 $ psrFactory = new Psr17Factory ();
@@ -34,10 +33,35 @@ public function testStateServerLeak(): void
3433
3534 //dataProvider is always random and we need to keep the order
3635 $ fixtures = [
37- [['Content-Type ' => ['application/html ' ], 'Connection ' => ['keep-alive ' ]], ['REQUEST_URI ' => 'http://localhost ' , 'REMOTE_ADDR ' => '127.0.0.1 ' , 'REQUEST_METHOD ' => 'GET ' , 'HTTP_USER_AGENT ' => '' , 'CONTENT_TYPE ' => 'application/html ' , 'HTTP_CONNECTION ' => 'keep-alive ' ,]],
38- [['Content-Type ' => ['application/json ' ]], ['REQUEST_URI ' => 'http://localhost ' , 'REMOTE_ADDR ' => '127.0.0.1 ' , 'REQUEST_METHOD ' => 'GET ' , 'HTTP_USER_AGENT ' => '' , 'CONTENT_TYPE ' => 'application/json ' ]],
36+ [
37+ [
38+ 'Content-Type ' => ['application/html ' ],
39+ 'Connection ' => ['keep-alive ' ]
40+ ],
41+ [
42+ 'REQUEST_URI ' => 'http://localhost ' ,
43+ 'REMOTE_ADDR ' => '127.0.0.1 ' ,
44+ 'REQUEST_METHOD ' => 'GET ' ,
45+ 'HTTP_USER_AGENT ' => '' ,
46+ 'CONTENT_TYPE ' => 'application/html ' ,
47+ 'HTTP_CONNECTION ' => 'keep-alive ' ,
48+ ],
49+ ],
50+ [
51+ [
52+ 'Content-Type ' => ['application/json ' ]
53+ ],
54+ [
55+ 'REQUEST_URI ' => 'http://localhost ' ,
56+ 'REMOTE_ADDR ' => '127.0.0.1 ' ,
57+ 'REQUEST_METHOD ' => 'GET ' ,
58+ 'HTTP_USER_AGENT ' => '' ,
59+ 'CONTENT_TYPE ' => 'application/json '
60+ ],
61+ ],
3962 ];
4063
64+ $ _SERVER = [];
4165 foreach ($ fixtures as [$ headers , $ expectedServer ]) {
4266 $ body = [
4367 'headers ' => $ headers ,
@@ -54,8 +78,6 @@ public function testStateServerLeak(): void
5478
5579 $ relay ->addFrames ($ frame );
5680
57- $ _SERVER = [];
58-
5981 $ psrWorker ->waitRequest ();
6082
6183 unset($ _SERVER ['REQUEST_TIME ' ]);
0 commit comments