@@ -119,6 +119,29 @@ public function testPostWithBatchedRequest(): void
119119 self ::assertSame ($ barQuery , $ barParams ->query );
120120 }
121121
122+ public function testPostWithBatchedRequestAndGetParams (): void
123+ {
124+ $ fooQuery = /** @lang GraphQL */ '{ foo } ' ;
125+ $ barQuery = /** @lang GraphQL */ '{ bar } ' ;
126+ $ request = $ this ->makeRequest (
127+ 'POST ' ,
128+ [],
129+ [],
130+ ['Content-Type ' => 'application/json ' ],
131+ \Safe \json_encode ([
132+ ['query ' => $ fooQuery ],
133+ ['query ' => $ barQuery ],
134+ ]),
135+ 'http://foo.bar/graphql?Operation=foo,bar '
136+ );
137+ $ params = (new RequestParser ())->parseRequest ($ request );
138+
139+ self ::assertIsArray ($ params );
140+ [$ fooParams , $ barParams ] = $ params ;
141+ self ::assertSame ($ fooQuery , $ fooParams ->query );
142+ self ::assertSame ($ barQuery , $ barParams ->query );
143+ }
144+
122145 public function testPostDefaultsToRegularForm (): void
123146 {
124147 $ query = /** @lang GraphQL */ '{ foo } ' ;
@@ -502,10 +525,10 @@ public function testMultipartFormWithNonJsonMap(): void
502525 * @param array<mixed> $headers
503526 * @param string|resource|null $content
504527 */
505- private function makeRequest (string $ method , array $ parameters = [], array $ files = [], array $ headers = [], $ content = null ): Request
528+ private function makeRequest (string $ method , array $ parameters = [], array $ files = [], array $ headers = [], $ content = null , string $ uri = ' http://foo.bar/graphql ' ): Request
506529 {
507530 $ symfonyRequest = SymfonyRequest::create (
508- ' http://foo.bar/graphql ' ,
531+ $ uri ,
509532 $ method ,
510533 $ parameters ,
511534 [],
0 commit comments