@@ -67,6 +67,7 @@ class GraphControllerTest extends TestCase
6767 public function testEndpointAction ($ uri ): void
6868 {
6969 $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
70+ $ this ->disableCatchExceptions ($ client );
7071
7172 $ client ->request ('GET ' , $ uri , ['query ' => $ this ->friendsQuery ], [], ['CONTENT_TYPE ' => 'application/graphql;charset=utf8 ' , 'HTTP_Origin ' => 'http://example.com ' ]);
7273 $ result = $ client ->getResponse ()->getContent ();
@@ -87,6 +88,7 @@ public function testEndpointWithEmptyQuery(): void
8788 $ this ->expectException (BadRequestHttpException::class);
8889 $ this ->expectExceptionMessage ('Must provide query parameter ' );
8990 $ client = static ::createClient ();
91+ $ this ->disableCatchExceptions ($ client );
9092 $ client ->request ('GET ' , '/ ' , []);
9193 $ client ->getResponse ()->getContent ();
9294 }
@@ -96,12 +98,14 @@ public function testEndpointWithEmptyPostJsonBodyQuery(): void
9698 $ this ->expectException (BadRequestHttpException::class);
9799 $ this ->expectExceptionMessage ('The request content body must not be empty when using json content type request. ' );
98100 $ client = static ::createClient ();
101+ $ this ->disableCatchExceptions ($ client );
99102 $ client ->request ('POST ' , '/ ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ]);
100103 }
101104
102105 public function testEndpointWithJsonContentTypeAndGetQuery (): void
103106 {
104107 $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
108+ $ this ->disableCatchExceptions ($ client );
105109 $ client ->request ('GET ' , '/ ' , ['query ' => $ this ->friendsQuery ], [], ['CONTENT_TYPE ' => 'application/json ' ]);
106110 $ result = $ client ->getResponse ()->getContent ();
107111 $ this ->assertSame (['data ' => $ this ->expectedData ], \json_decode ($ result , true ), $ result );
@@ -112,13 +116,15 @@ public function testEndpointWithInvalidBodyQuery(): void
112116 $ this ->expectException (BadRequestHttpException::class);
113117 $ this ->expectExceptionMessage ('POST body sent invalid JSON ' );
114118 $ client = static ::createClient ();
119+ $ this ->disableCatchExceptions ($ client );
115120 $ client ->request ('GET ' , '/ ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{ ' );
116121 $ client ->getResponse ()->getContent ();
117122 }
118123
119124 public function testEndpointActionWithVariables (): void
120125 {
121126 $ client = static ::createClient (['test_case ' => 'connection ' ]);
127+ $ this ->disableCatchExceptions ($ client );
122128
123129 $ query = <<<'EOF'
124130query FriendsQuery($firstFriends: Int) {
@@ -146,6 +152,7 @@ public function testEndpointActionWithInvalidVariables(): void
146152 $ this ->expectException (BadRequestHttpException::class);
147153 $ this ->expectExceptionMessage ('Variables are invalid JSON ' );
148154 $ client = static ::createClient (['test_case ' => 'connection ' ]);
155+ $ this ->disableCatchExceptions ($ client );
149156
150157 $ query = <<<'EOF'
151158query {
@@ -161,6 +168,7 @@ public function testMultipleEndpointActionWithUnknownSchemaName(): void
161168 $ this ->expectException (NotFoundHttpException::class);
162169 $ this ->expectExceptionMessage ('Could not found "fake" schema. ' );
163170 $ client = static ::createClient (['test_case ' => 'connection ' ]);
171+ $ this ->disableCatchExceptions ($ client );
164172
165173 $ query = <<<'EOF'
166174query {
@@ -174,6 +182,7 @@ public function testMultipleEndpointActionWithUnknownSchemaName(): void
174182 public function testEndpointActionWithOperationName (): void
175183 {
176184 $ client = static ::createClient (['test_case ' => 'connection ' ]);
185+ $ this ->disableCatchExceptions ($ client );
177186
178187 $ query = $ this ->friendsQuery ."\n" .$ this ->friendsTotalCountQuery ;
179188
@@ -189,6 +198,7 @@ public function testEndpointActionWithOperationName(): void
189198 public function testBatchEndpointAction ($ uri ): void
190199 {
191200 $ client = static ::createClient (['test_case ' => 'connection ' ]);
201+ $ this ->disableCatchExceptions ($ client );
192202
193203 $ data = [
194204 [
@@ -224,6 +234,7 @@ public function testBatchEndpointWithEmptyQuery(): void
224234 $ this ->expectException (BadRequestHttpException::class);
225235 $ this ->expectExceptionMessage ('Must provide at least one valid query. ' );
226236 $ client = static ::createClient ();
237+ $ this ->disableCatchExceptions ($ client );
227238 $ client ->request ('GET ' , '/batch ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{} ' );
228239 $ client ->getResponse ()->getContent ();
229240 }
@@ -233,6 +244,7 @@ public function testBatchEndpointWrongContentType(): void
233244 $ this ->expectException (BadRequestHttpException::class);
234245 $ this ->expectExceptionMessage ('Batching parser only accepts "application/json" or "multipart/form-data" content-type but got "". ' );
235246 $ client = static ::createClient ();
247+ $ this ->disableCatchExceptions ($ client );
236248 $ client ->request ('GET ' , '/batch ' );
237249 $ client ->getResponse ()->getContent ();
238250 }
@@ -242,6 +254,7 @@ public function testBatchEndpointWithInvalidJson(): void
242254 $ this ->expectException (BadRequestHttpException::class);
243255 $ this ->expectExceptionMessage ('POST body sent invalid JSON ' );
244256 $ client = static ::createClient ();
257+ $ this ->disableCatchExceptions ($ client );
245258 $ client ->request ('GET ' , '/batch ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{ ' );
246259 $ client ->getResponse ()->getContent ();
247260 }
@@ -251,13 +264,15 @@ public function testBatchEndpointWithInvalidQuery(): void
251264 $ this ->expectException (BadRequestHttpException::class);
252265 $ this ->expectExceptionMessage ('1 is not a valid query ' );
253266 $ client = static ::createClient ();
267+ $ this ->disableCatchExceptions ($ client );
254268 $ client ->request ('GET ' , '/batch ' , [], [], ['CONTENT_TYPE ' => 'application/json ' ], '{"test" : {"query": 1}} ' );
255269 $ client ->getResponse ()->getContent ();
256270 }
257271
258272 public function testPreflightedRequestWhenDisabled (): void
259273 {
260274 $ client = static ::createClient (['test_case ' => 'connection ' ]);
275+ $ this ->disableCatchExceptions ($ client );
261276 $ client ->request ('OPTIONS ' , '/ ' , [], [], ['HTTP_Origin ' => 'http://example.com ' ]);
262277 $ response = $ client ->getResponse ();
263278 $ this ->assertSame (200 , $ response ->getStatusCode ());
@@ -267,21 +282,23 @@ public function testPreflightedRequestWhenDisabled(): void
267282 public function testUnAuthorizedMethod (): void
268283 {
269284 $ client = static ::createClient (['test_case ' => 'connection ' ]);
285+ $ this ->disableCatchExceptions ($ client );
270286 $ client ->request ('PUT ' , '/ ' , [], [], ['HTTP_Origin ' => 'http://example.com ' ]);
271287 $ this ->assertSame (405 , $ client ->getResponse ()->getStatusCode ());
272288 }
273289
274290 public function testPreflightedRequestWhenEnabled (): void
275291 {
276292 $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
293+ $ this ->disableCatchExceptions ($ client );
277294 $ client ->request ('OPTIONS ' , '/batch ' , [], [], ['HTTP_Origin ' => 'http://example.com ' ]);
278295 $ this ->assertCORSHeadersExists ($ client );
279296 }
280297
281298 public function testNoCORSHeadersIfOriginHeaderNotExists (): void
282299 {
283300 $ client = static ::createClient (['test_case ' => 'connectionWithCORS ' ]);
284-
301+ $ this -> disableCatchExceptions ( $ client );
285302 $ client ->request ('GET ' , '/ ' , ['query ' => $ this ->friendsQuery ], [], ['CONTENT_TYPE ' => 'application/graphql ' ]);
286303 $ result = $ client ->getResponse ()->getContent ();
287304 $ this ->assertSame (['data ' => $ this ->expectedData ], \json_decode ($ result , true ), $ result );
0 commit comments