@@ -229,7 +229,7 @@ public function testInjectQuery(): void
229
229
], $ result );
230
230
}
231
231
232
- public function testLoginQuery (): void
232
+ public function testLoginQueryWithRequestParams (): void
233
233
{
234
234
$ kernel = new GraphQLiteTestingKernel ();
235
235
$ kernel ->boot ();
@@ -247,7 +247,43 @@ public function testLoginQuery(): void
247
247
}
248
248
' ];
249
249
250
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters , [], [], ['CONTENT_TYPE ' => 'application/json ' ]);
250
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
251
+
252
+ $ response = $ kernel ->handle ($ request );
253
+
254
+ $ result = json_decode ($ response ->getContent (), true );
255
+
256
+ $ this ->assertSame ([
257
+ 'data ' => [
258
+ 'login ' => [
259
+ 'userName ' => 'foo ' ,
260
+ 'roles ' => [
261
+ 'ROLE_USER '
262
+ ]
263
+ ]
264
+ ]
265
+ ], $ result );
266
+ }
267
+
268
+ public function testLoginQueryWithRequestBody (): void
269
+ {
270
+ $ kernel = new GraphQLiteTestingKernel ();
271
+ $ kernel ->boot ();
272
+
273
+ $ session = new Session (new MockArraySessionStorage ());
274
+ $ container = $ kernel ->getContainer ();
275
+ $ container ->set ('session ' , $ session );
276
+
277
+ $ body = ['query ' => '
278
+ mutation login {
279
+ login(userName: "foo", password: "bar") {
280
+ userName
281
+ roles
282
+ }
283
+ }
284
+ ' ];
285
+
286
+ $ request = Request::create ('/graphql ' , 'POST ' , [], [], [], ['CONTENT_TYPE ' => 'application/json ' ], json_encode ($ body ));
251
287
252
288
$ response = $ kernel ->handle ($ request );
253
289
@@ -283,7 +319,7 @@ public function testMeQuery(): void
283
319
}
284
320
' ];
285
321
286
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
322
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
287
323
288
324
$ response = $ kernel ->handle ($ request );
289
325
@@ -310,7 +346,7 @@ public function testNoLoginNoSessionQuery(): void
310
346
}
311
347
' ];
312
348
313
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
349
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
314
350
315
351
$ response = $ kernel ->handle ($ request );
316
352
@@ -394,7 +430,7 @@ public function testAllOff(): void
394
430
}
395
431
' ];
396
432
397
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
433
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
398
434
399
435
$ response = $ kernel ->handle ($ request );
400
436
@@ -418,7 +454,7 @@ public function testValidation(): void
418
454
}
419
455
' ];
420
456
421
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
457
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
422
458
423
459
$ response = $ kernel ->handle ($ request );
424
460
@@ -445,7 +481,7 @@ public function testWithIntrospection(): void
445
481
}
446
482
' ];
447
483
448
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
484
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
449
485
450
486
$ response = $ kernel ->handle ($ request );
451
487
@@ -470,7 +506,7 @@ public function testDisableIntrospection(): void
470
506
}
471
507
' ];
472
508
473
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
509
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
474
510
475
511
$ response = $ kernel ->handle ($ request );
476
512
@@ -498,7 +534,7 @@ public function testMaxQueryComplexity(): void
498
534
}
499
535
' ];
500
536
501
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
537
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
502
538
503
539
$ response = $ kernel ->handle ($ request );
504
540
@@ -532,7 +568,7 @@ public function testMaxQueryDepth(): void
532
568
}
533
569
' ];
534
570
535
- $ request = Request::create ('/graphql ' , 'POST ' , $ parameters, [], [], [ ' CONTENT_TYPE ' => ' application/json ' ] );
571
+ $ request = Request::create ('/graphql ' , 'POST ' , $ parameters );
536
572
537
573
$ response = $ kernel ->handle ($ request );
538
574
0 commit comments