public function testExposesDescriptionsOnTypesAndFields()
{
$QueryRoot = new ObjectType(['name' => 'QueryRoot', 'fields' => []]);
$schema = new Schema(['query' => $QueryRoot]);
$request = '
{
schemaType: __type(name: "__Schema") {
name,
description,
fields {
name,
description
}
}
}
';
$expected = ['data' => ['schemaType' => ['name' => '__Schema', 'description' => 'A GraphQL Schema defines the capabilities of a ' . 'GraphQL server. It exposes all available types and ' . 'directives on the server, as well as the entry ' . 'points for query and mutation operations.', 'fields' => [['name' => 'types', 'description' => 'A list of all types supported by this server.'], ['name' => 'queryType', 'description' => 'The type that query operations will be rooted at.'], ['name' => 'mutationType', 'description' => 'If this server supports mutation, the type that ' . 'mutation operations will be rooted at.'], ['name' => 'subscriptionType', 'description' => 'If this server support subscription, the type that subscription operations will be rooted at.'], ['name' => 'directives', 'description' => 'A list of all directives supported by this server.']]]]];
$this->assertEquals($expected, GraphQL::execute($schema, $request));
}