1717
1818class ValuesHelperTest extends TestCase
1919{
20- /**
21- * @throws \Digia\GraphQL\Error\InvariantException
22- * @throws \Digia\GraphQL\Error\SyntaxErrorException
23- */
2420 public function testCoerceArgumentValues ()
2521 {
22+ /** @noinspection PhpUnhandledExceptionInspection */
2623 $ schema = newSchema ([
27- 'query ' =>
28- newObjectType ([
29- 'name ' => 'Greeting ' ,
30- 'fields ' => [
31- 'greeting ' => [
32- 'type ' => stringType (),
33- 'args ' => [
34- 'name ' => [
35- 'type ' => stringType (),
36- ]
37- ]
38- ]
39- ]
40- ])
24+ 'query ' => newObjectType ([
25+ 'name ' => 'Greeting ' ,
26+ 'fields ' => [
27+ 'greeting ' => [
28+ 'type ' => stringType (),
29+ 'args ' => [
30+ 'name ' => [
31+ 'type ' => stringType (),
32+ ],
33+ ],
34+ ],
35+ ],
36+ ]),
4137 ]);
4238
39+ /** @noinspection PhpUnhandledExceptionInspection */
4340 $ documentNode = parse ('query Hello($name: String) { Greeting(name: $name) } ' );
4441 /** @var OperationDefinitionNode $operation */
4542 $ operation = $ documentNode ->getDefinitions ()[0 ];
4643 /** @var ArgumentsAwareInterface $node */
47- $ node = $ operation ->getSelectionSet ()->getSelections ()[0 ];
44+ $ node = $ operation ->getSelectionSet ()->getSelections ()[0 ];
45+ /** @noinspection PhpUnhandledExceptionInspection */
4846 $ definition = $ schema ->getQueryType ()->getFields ()['greeting ' ];
4947
5048 $ context = new ExecutionContext (
@@ -56,30 +54,26 @@ public function testCoerceArgumentValues()
5654 $ this ->assertSame (['name ' => 'Han Solo ' ], $ args );
5755 }
5856
59- /**
60- * @throws \Digia\GraphQL\Error\InvariantException
61- * @throws \Digia\GraphQL\Error\SyntaxErrorException
62- */
6357 public function testCoerceVariableValues (): void
6458 {
65- // Test that non-nullable booleans are handled correctly
59+ /** @noinspection PhpUnhandledExceptionInspection */
6660 $ schema = newSchema ([
67- 'query ' =>
68- newObjectType ([
69- 'name ' => 'nonNullBoolean ' ,
70- 'fields ' => [
71- 'greeting ' => [
72- 'type ' => stringType (),
73- 'args ' => [
74- 'shout ' => [
75- 'type ' => newNonNull (booleanType ()),
76- ]
77- ]
78- ]
79- ]
80- ])
61+ 'query ' => newObjectType ([
62+ 'name ' => 'nonNullBoolean ' ,
63+ 'fields ' => [
64+ 'greeting ' => [
65+ 'type ' => stringType (),
66+ 'args ' => [
67+ 'shout ' => [
68+ 'type ' => newNonNull (booleanType ()),
69+ ],
70+ ],
71+ ],
72+ ],
73+ ]),
8174 ]);
8275
76+ /** @noinspection PhpUnhandledExceptionInspection */
8377 $ documentNode = parse ('
8478 query ($shout: Boolean!) {
8579 nonNullBoolean(shout: $shout)
@@ -92,11 +86,11 @@ public function testCoerceVariableValues(): void
9286
9387 // Try with true and false and null (null should give errors, the rest shouldn't)
9488 $ coercedValue = coerceVariableValues ($ schema , $ variableDefinitions , ['shout ' => true ]);
95- $ this ->assertEquals (['shout ' => true ], $ coercedValue ->getValue ());
89+ $ this ->assertSame (['shout ' => true ], $ coercedValue ->getValue ());
9690 $ this ->assertFalse ($ coercedValue ->hasErrors ());
9791
9892 $ coercedValue = coerceVariableValues ($ schema , $ variableDefinitions , ['shout ' => false ]);
99- $ this ->assertEquals (['shout ' => false ], $ coercedValue ->getValue ());
93+ $ this ->assertSame (['shout ' => false ], $ coercedValue ->getValue ());
10094 $ this ->assertFalse ($ coercedValue ->hasErrors ());
10195
10296 $ coercedValue = coerceVariableValues ($ schema , $ variableDefinitions , ['shout ' => null ]);
0 commit comments