| Conditions | 1 |
| Paths | 1 |
| Total Lines | 32 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | public function testType() |
||
| 22 | { |
||
| 23 | $reportType = new ObjectType([ |
||
| 24 | 'name' => 'Report', |
||
| 25 | 'fields' => [ |
||
| 26 | 'time' => new TestTimeType(), |
||
| 27 | 'title' => new StringType(), |
||
| 28 | ] |
||
| 29 | ]); |
||
| 30 | $processor = new Processor(new Schema([ |
||
| 31 | 'query' => new ObjectType([ |
||
| 32 | 'name' => 'RootQueryType', |
||
| 33 | 'fields' => [ |
||
| 34 | 'latestReport' => [ |
||
| 35 | 'type' => $reportType, |
||
| 36 | 'resolve' => function () { |
||
| 37 | return [ |
||
| 38 | 'title' => 'Accident #1', |
||
| 39 | 'time' => '13:30:12', |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | ], |
||
| 43 | ] |
||
| 44 | ]) |
||
| 45 | ]) |
||
| 46 | ); |
||
| 47 | |||
| 48 | $processor->processPayload('{ latestReport { title, time} }'); |
||
| 49 | $this->assertEquals(['data' => ['latestReport' => ['title' => 'Accident #1', 'time' => '13:30:12']]], $processor->getResponseData()); |
||
| 50 | |||
| 51 | |||
| 52 | } |
||
| 53 | |||
| 54 | } |