| @@ 198-223 (lines=26) @@ | ||
| 195 | ], $data); |
|
| 196 | } |
|
| 197 | ||
| 198 | public function testFragmentWithFields() |
|
| 199 | { |
|
| 200 | $parser = new Parser(); |
|
| 201 | $data = $parser->parse(' |
|
| 202 | fragment FullType on __Type { |
|
| 203 | kind |
|
| 204 | fields { |
|
| 205 | name |
|
| 206 | } |
|
| 207 | }'); |
|
| 208 | $this->assertEquals([ |
|
| 209 | 'queries' => [], |
|
| 210 | 'mutations' => [], |
|
| 211 | 'fragments' => [ |
|
| 212 | new Fragment('FullType', '__Type', [], [ |
|
| 213 | new Field('kind', null, [], [], new Location(3, 17)), |
|
| 214 | new Query('fields', null, [], [ |
|
| 215 | new Field('name', null, [], [], new Location(5, 21)), |
|
| 216 | ], [], new Location(4, 17)), |
|
| 217 | ], new Location(2, 22)), |
|
| 218 | ], |
|
| 219 | 'fragmentReferences' => [], |
|
| 220 | 'variables' => [], |
|
| 221 | 'variableReferences' => [], |
|
| 222 | ], $data); |
|
| 223 | } |
|
| 224 | ||
| 225 | public function testInspectionQuery() |
|
| 226 | { |
|
| @@ 434-462 (lines=29) @@ | ||
| 431 | $this->assertEquals($parsedStructure, $structure); |
|
| 432 | } |
|
| 433 | ||
| 434 | public function testTypedFragment() |
|
| 435 | { |
|
| 436 | $parser = new Parser(); |
|
| 437 | $parsedStructure = $parser->parse(' |
|
| 438 | { |
|
| 439 | test: test { |
|
| 440 | name, |
|
| 441 | ... on UnionType { |
|
| 442 | unionName |
|
| 443 | } |
|
| 444 | } |
|
| 445 | } |
|
| 446 | '); |
|
| 447 | ||
| 448 | $this->assertEquals($parsedStructure, [ |
|
| 449 | 'queries' => [ |
|
| 450 | new Query('test', 'test', [], |
|
| 451 | [ |
|
| 452 | new Field('name', null, [], [], new Location(4, 21)), |
|
| 453 | new TypedFragmentReference('UnionType', [new Field('unionName', null, [], [], new Location(6, 25))], [], new Location(5, 28)), |
|
| 454 | ], [], new Location(3, 23)), |
|
| 455 | ], |
|
| 456 | 'mutations' => [], |
|
| 457 | 'fragments' => [], |
|
| 458 | 'fragmentReferences' => [], |
|
| 459 | 'variables' => [], |
|
| 460 | 'variableReferences' => [], |
|
| 461 | ]); |
|
| 462 | } |
|
| 463 | ||
| 464 | public function mutationProvider() |
|
| 465 | { |
|