@@ -66,7 +66,7 @@ final class GraphControllerTest extends TestCase
6666 */
6767 public function testEndpointAction (string $ uri ): void
6868 {
69- $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
69+ $ client = self ::createClient (['test_case ' => 'connectionWithCORS ' ]);
7070 $ this ->disableCatchExceptions ($ client );
7171
7272 $ client ->request ('GET ' , $ uri , ['query ' => $ this ->friendsQuery ], [], ['CONTENT_TYPE ' => 'application/graphql;charset=utf8 ' , 'HTTP_Origin ' => 'http://example.com ' ]);
@@ -87,7 +87,7 @@ public function testEndpointWithEmptyQuery(): void
8787 {
8888 $ this ->expectException (BadRequestHttpException::class);
8989 $ this ->expectExceptionMessage ('Must provide query parameter ' );
90- $ client = static ::createClient ();
90+ $ client = self ::createClient ();
9191 $ this ->disableCatchExceptions ($ client );
9292 $ client ->request ('GET ' , '/ ' , []);
9393 $ client ->getResponse ()->getContent ();
@@ -97,14 +97,14 @@ public function testEndpointWithEmptyPostJsonBodyQuery(): void
9797 {
9898 $ this ->expectException (BadRequestHttpException::class);
9999 $ this ->expectExceptionMessage ('The request content body must not be empty when using json content type request. ' );
100- $ client = static ::createClient ();
100+ $ client = self ::createClient ();
101101 $ this ->disableCatchExceptions ($ client );
102102 $ client ->request ('POST ' , '/ ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ]);
103103 }
104104
105105 public function testEndpointWithJsonContentTypeAndGetQuery (): void
106106 {
107- $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
107+ $ client = self ::createClient (['test_case ' => 'connectionWithCORS ' ]);
108108 $ this ->disableCatchExceptions ($ client );
109109 $ client ->request ('GET ' , '/ ' , ['query ' => $ this ->friendsQuery ], [], ['CONTENT_TYPE ' => 'application/json ' ]);
110110 $ result = $ client ->getResponse ()->getContent ();
@@ -115,15 +115,15 @@ public function testEndpointWithInvalidBodyQuery(): void
115115 {
116116 $ this ->expectException (BadRequestHttpException::class);
117117 $ this ->expectExceptionMessage ('POST body sent invalid JSON ' );
118- $ client = static ::createClient ();
118+ $ client = self ::createClient ();
119119 $ this ->disableCatchExceptions ($ client );
120120 $ client ->request ('GET ' , '/ ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{ ' );
121121 $ client ->getResponse ()->getContent ();
122122 }
123123
124124 public function testEndpointActionWithVariables (): void
125125 {
126- $ client = static ::createClient (['test_case ' => 'connection ' ]);
126+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
127127 $ this ->disableCatchExceptions ($ client );
128128
129129 $ query = <<<'EOF'
@@ -151,7 +151,7 @@ public function testEndpointActionWithInvalidVariables(): void
151151 {
152152 $ this ->expectException (BadRequestHttpException::class);
153153 $ this ->expectExceptionMessage ('Variables are invalid JSON ' );
154- $ client = static ::createClient (['test_case ' => 'connection ' ]);
154+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
155155 $ this ->disableCatchExceptions ($ client );
156156
157157 $ query = <<<'EOF'
@@ -167,7 +167,7 @@ public function testMultipleEndpointActionWithUnknownSchemaName(): void
167167 {
168168 $ this ->expectException (NotFoundHttpException::class);
169169 $ this ->expectExceptionMessage ('Could not find "fake" schema. ' );
170- $ client = static ::createClient (['test_case ' => 'connection ' ]);
170+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
171171 $ this ->disableCatchExceptions ($ client );
172172
173173 $ query = <<<'EOF'
@@ -181,7 +181,7 @@ public function testMultipleEndpointActionWithUnknownSchemaName(): void
181181
182182 public function testEndpointActionWithOperationName (): void
183183 {
184- $ client = static ::createClient (['test_case ' => 'connection ' ]);
184+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
185185 $ this ->disableCatchExceptions ($ client );
186186
187187 $ query = $ this ->friendsQuery ."\n" .$ this ->friendsTotalCountQuery ;
@@ -196,7 +196,7 @@ public function testEndpointActionWithOperationName(): void
196196 */
197197 public function testBatchEndpointAction (string $ uri ): void
198198 {
199- $ client = static ::createClient (['test_case ' => 'connection ' ]);
199+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
200200 $ this ->disableCatchExceptions ($ client );
201201
202202 $ data = [
@@ -233,7 +233,7 @@ public function testBatchEndpointWithEmptyQuery(): void
233233 {
234234 $ this ->expectException (BadRequestHttpException::class);
235235 $ this ->expectExceptionMessage ('Must provide at least one valid query. ' );
236- $ client = static ::createClient ();
236+ $ client = self ::createClient ();
237237 $ this ->disableCatchExceptions ($ client );
238238 $ client ->request ('GET ' , '/batch ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{} ' );
239239 $ client ->getResponse ()->getContent ();
@@ -243,7 +243,7 @@ public function testBatchEndpointWrongContentType(): void
243243 {
244244 $ this ->expectException (BadRequestHttpException::class);
245245 $ this ->expectExceptionMessage ('Batching parser only accepts "application/json" or "multipart/form-data" content-type but got "". ' );
246- $ client = static ::createClient ();
246+ $ client = self ::createClient ();
247247 $ this ->disableCatchExceptions ($ client );
248248 $ client ->request ('GET ' , '/batch ' );
249249 $ client ->getResponse ()->getContent ();
@@ -253,7 +253,7 @@ public function testBatchEndpointWithInvalidJson(): void
253253 {
254254 $ this ->expectException (BadRequestHttpException::class);
255255 $ this ->expectExceptionMessage ('POST body sent invalid JSON ' );
256- $ client = static ::createClient ();
256+ $ client = self ::createClient ();
257257 $ this ->disableCatchExceptions ($ client );
258258 $ client ->request ('GET ' , '/batch ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{ ' );
259259 $ client ->getResponse ()->getContent ();
@@ -263,15 +263,15 @@ public function testBatchEndpointWithInvalidQuery(): void
263263 {
264264 $ this ->expectException (BadRequestHttpException::class);
265265 $ this ->expectExceptionMessage ('1 is not a valid query ' );
266- $ client = static ::createClient ();
266+ $ client = self ::createClient ();
267267 $ this ->disableCatchExceptions ($ client );
268268 $ client ->request ('GET ' , '/batch ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{"test" : {"query": 1}} ' );
269269 $ client ->getResponse ()->getContent ();
270270 }
271271
272272 public function testPreflightedRequestWhenDisabled (): void
273273 {
274- $ client = static ::createClient (['test_case ' => 'connection ' ]);
274+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
275275 $ this ->disableCatchExceptions ($ client );
276276 $ client ->request ('OPTIONS ' , '/ ' , [], [], ['HTTP_Origin ' => 'http://example.com ' ]);
277277 $ response = $ client ->getResponse ();
@@ -281,34 +281,31 @@ public function testPreflightedRequestWhenDisabled(): void
281281
282282 public function testUnAuthorizedMethod (): void
283283 {
284- $ client = static ::createClient (['test_case ' => 'connection ' ]);
284+ $ client = self ::createClient (['test_case ' => 'connection ' ]);
285285 $ this ->disableCatchExceptions ($ client );
286286 $ client ->request ('PUT ' , '/ ' , [], [], ['HTTP_Origin ' => 'http://example.com ' ]);
287287 $ this ->assertSame (405 , $ client ->getResponse ()->getStatusCode ());
288288 }
289289
290290 public function testPreflightedRequestWhenEnabled (): void
291291 {
292- $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
292+ $ client = self ::createClient (['test_case ' => 'connectionWithCORS ' ]);
293293 $ this ->disableCatchExceptions ($ client );
294294 $ client ->request ('OPTIONS ' , '/batch ' , [], [], ['HTTP_Origin ' => 'http://example.com ' ]);
295295 $ this ->assertCORSHeadersExists ($ client );
296296 }
297297
298298 public function testNoCORSHeadersIfOriginHeaderNotExists (): void
299299 {
300- $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
300+ $ client = self ::createClient (['test_case ' => 'connectionWithCORS ' ]);
301301 $ this ->disableCatchExceptions ($ client );
302302 $ client ->request ('GET ' , '/ ' , ['query ' => $ this ->friendsQuery ], [], ['CONTENT_TYPE ' => 'application/graphql ' ]);
303303 $ result = $ client ->getResponse ()->getContent ();
304304 $ this ->assertSame (['data ' => $ this ->expectedData ], json_decode ($ result , true ), $ result );
305305 $ this ->assertCORSHeadersNotExists ($ client );
306306 }
307307
308- /**
309- * @param KernelBrowser $client
310- */
311- private function assertCORSHeadersNotExists ($ client ): void
308+ private function assertCORSHeadersNotExists (KernelBrowser $ client ): void
312309 {
313310 $ headers = $ client ->getResponse ()->headers ->all ();
314311 $ this ->assertArrayNotHasKey ('access-control-allow-origin ' , $ headers );
@@ -318,10 +315,7 @@ private function assertCORSHeadersNotExists($client): void
318315 $ this ->assertArrayNotHasKey ('access-control-max-age ' , $ headers );
319316 }
320317
321- /**
322- * @param KernelBrowser $client
323- */
324- private function assertCORSHeadersExists ($ client ): void
318+ private function assertCORSHeadersExists (KernelBrowser $ client ): void
325319 {
326320 $ response = $ client ->getResponse ();
327321 $ this ->assertSame (200 , $ response ->getStatusCode ());
0 commit comments