File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -365,17 +365,11 @@ public function buildSchemaFromConfig(array $schemaConfig): Schema
365
365
366
366
$ this ->addTypes ($ schemaTypes );
367
367
368
- $ query = $ this ->objectType ($ schemaQuery , [
369
- 'name ' => 'Query ' ,
370
- ]);
368
+ $ query = $ this ->objectType ($ schemaQuery , ['name ' => 'Query ' ]);
371
369
372
- $ mutation = $ schemaMutation
373
- ? $ this ->objectType ($ schemaMutation , ['name ' => 'Mutation ' ])
374
- : null ;
370
+ $ mutation = $ this ->objectType ($ schemaMutation , ['name ' => 'Mutation ' ]);
375
371
376
- $ subscription = $ schemaSubscription
377
- ? $ this ->objectType ($ schemaSubscription , ['name ' => 'Subscription ' ])
378
- : null ;
372
+ $ subscription = $ this ->objectType ($ schemaSubscription , ['name ' => 'Subscription ' ]);
379
373
380
374
$ directives = Directive::getInternalDirectives ();
381
375
Original file line number Diff line number Diff line change 3
3
declare (strict_types = 1 );
4
4
namespace Rebing \GraphQL \Tests \Unit ;
5
5
6
+ use GraphQL \Utils \SchemaPrinter ;
6
7
use Rebing \GraphQL \Support \Facades \GraphQL ;
7
8
use Rebing \GraphQL \Tests \Support \Objects \ExamplesQuery ;
8
9
use Rebing \GraphQL \Tests \TestCase ;
@@ -212,4 +213,21 @@ public function testCustomDefaultFieldResolverClosure(): void
212
213
self ::assertSame ($ expectedDataResult , $ result ->data );
213
214
self ::assertCount (0 , $ result ->errors );
214
215
}
216
+
217
+ public function testPrintSchema (): void
218
+ {
219
+ $ schema = GraphQL::buildSchemaFromConfig ([
220
+ 'query ' => [
221
+ 'examplesCustom ' => ExamplesQuery::class,
222
+ ],
223
+ ]);
224
+
225
+ $ gql = SchemaPrinter::doPrint ($ schema );
226
+
227
+ $ queryFragment = 'type Query {
228
+ examplesCustom(index: Int): [Example]
229
+ } ' ;
230
+
231
+ self ::assertStringContainsString ($ queryFragment , $ gql );
232
+ }
215
233
}
You can’t perform that action at this time.
0 commit comments