File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ protected function constructArguments(): string
189189 }
190190
191191 // Convert argument values to graphql string literal equivalent
192- if (is_scalar ($ value )) {
192+ if (is_scalar ($ value ) || $ value === null ) {
193193 // Convert scalar value to its literal in graphql
194194 $ value = StringLiteralFormatter::formatValueForRHS ($ value );
195195 } elseif (is_array ($ value )) {
Original file line number Diff line number Diff line change @@ -353,6 +353,31 @@ public function testBooleanArgumentValue(Query $query)
353353 return $ query ;
354354 }
355355
356+ /**
357+ * @depends clone testEmptyArguments
358+ *
359+ * @covers \GraphQL\Query::setArguments
360+ * @covers \GraphQL\Query::constructArguments
361+ *
362+ * @param Query $query
363+ *
364+ * @return Query
365+ */
366+ public function testNullArgumentValue (Query $ query )
367+ {
368+ $ query ->setArguments (['arg1 ' => null ]);
369+ $ this ->assertEquals (
370+ "query {
371+ Object(arg1: null) {
372+
373+ }
374+ } "
375+ , (string ) $ query
376+ );
377+
378+ return $ query ;
379+ }
380+
356381 /**
357382 * @depends clone testEmptyArguments
358383 *
You can’t perform that action at this time.
0 commit comments