Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function testInputObjectValidation() |
||
17 | { |
||
18 | $schemaStr = ' |
||
19 | input MsgInput { |
||
20 | msg: String |
||
21 | } |
||
22 | |||
23 | type Query { |
||
24 | echo(msg: MsgInput): String |
||
25 | } |
||
26 | |||
27 | schema { |
||
28 | query: Query |
||
29 | } |
||
30 | '; |
||
31 | |||
32 | $query = ' |
||
33 | query echo ($msg: MsgInput) { |
||
34 | echo (msg: $msg) |
||
35 | }'; |
||
36 | $variables = ['msg' => ['my message']]; |
||
37 | |||
38 | $schema = BuildSchema::build($schemaStr); |
||
39 | $result = GraphQL::executeQuery($schema, $query, null, null, $variables); |
||
40 | |||
41 | $expectedError = 'Variable "$msg" got invalid value ["my message"]; Field "0" is not defined by type MsgInput.'; |
||
42 | self::assertCount(1, $result->errors); |
||
43 | self::assertEquals($expectedError, $result->errors[0]->getMessage()); |
||
44 | } |
||
46 |