| @@ 153-178 (lines=26) @@ | ||
| 150 | ], $data); |
|
| 151 | } |
|
| 152 | ||
| 153 | public function testFragmentWithFields() |
|
| 154 | { |
|
| 155 | $parser = new Parser(); |
|
| 156 | $data = $parser->parse(' |
|
| 157 | fragment FullType on __Type { |
|
| 158 | kind |
|
| 159 | fields { |
|
| 160 | name |
|
| 161 | } |
|
| 162 | }'); |
|
| 163 | $this->assertEquals([ |
|
| 164 | 'queries' => [], |
|
| 165 | 'mutations' => [], |
|
| 166 | 'fragments' => [ |
|
| 167 | new Fragment('FullType', '__Type', [ |
|
| 168 | new Field('kind', null, [], new Location(3, 17)), |
|
| 169 | new Query('fields', null, [], [ |
|
| 170 | new Field('name', null, [], new Location(5, 21)) |
|
| 171 | ], new Location(4, 17)) |
|
| 172 | ], new Location(2, 22)) |
|
| 173 | ], |
|
| 174 | 'fragmentReferences' => [], |
|
| 175 | 'variables' => [], |
|
| 176 | 'variableReferences' => [], |
|
| 177 | ], $data); |
|
| 178 | } |
|
| 179 | ||
| 180 | public function testInspectionQuery() |
|
| 181 | { |
|
| @@ 389-417 (lines=29) @@ | ||
| 386 | $this->assertEquals($parsedStructure, $structure); |
|
| 387 | } |
|
| 388 | ||
| 389 | public function testTypedFragment() |
|
| 390 | { |
|
| 391 | $parser = new Parser(); |
|
| 392 | $parsedStructure = $parser->parse(' |
|
| 393 | { |
|
| 394 | test: test { |
|
| 395 | name, |
|
| 396 | ... on UnionType { |
|
| 397 | unionName |
|
| 398 | } |
|
| 399 | } |
|
| 400 | } |
|
| 401 | '); |
|
| 402 | ||
| 403 | $this->assertEquals($parsedStructure, [ |
|
| 404 | 'queries' => [ |
|
| 405 | new Query('test', 'test', [], |
|
| 406 | [ |
|
| 407 | new Field('name', null, [], new Location(4, 21)), |
|
| 408 | new TypedFragmentReference('UnionType', [new Field('unionName', null, [], new Location(6, 25))], new Location(5, 28)) |
|
| 409 | ], new Location(3, 23)) |
|
| 410 | ], |
|
| 411 | 'mutations' => [], |
|
| 412 | 'fragments' => [], |
|
| 413 | 'fragmentReferences' => [], |
|
| 414 | 'variables' => [], |
|
| 415 | 'variableReferences' => [] |
|
| 416 | ]); |
|
| 417 | } |
|
| 418 | ||
| 419 | public function mutationProvider() |
|
| 420 | { |
|