public function testExposesDescriptionsOnEnums()
{
$QueryRoot = new ObjectType(['name' => 'QueryRoot', 'fields' => []]);
$schema = new Schema(['query' => $QueryRoot]);
$request = '
{
typeKindType: __type(name: "__TypeKind") {
name,
description,
enumValues {
name,
description
}
}
}
';
$expected = ['data' => ['typeKindType' => ['name' => '__TypeKind', 'description' => 'An enum describing what kind of type a given __Type is.', 'enumValues' => [['description' => 'Indicates this type is a scalar.', 'name' => 'SCALAR'], ['description' => 'Indicates this type is an object. ' . '`fields` and `interfaces` are valid fields.', 'name' => 'OBJECT'], ['description' => 'Indicates this type is an interface. ' . '`fields` and `possibleTypes` are valid fields.', 'name' => 'INTERFACE'], ['description' => 'Indicates this type is a union. ' . '`possibleTypes` is a valid field.', 'name' => 'UNION'], ['description' => 'Indicates this type is an enum. ' . '`enumValues` is a valid field.', 'name' => 'ENUM'], ['description' => 'Indicates this type is an input object. ' . '`inputFields` is a valid field.', 'name' => 'INPUT_OBJECT'], ['description' => 'Indicates this type is a list. ' . '`ofType` is a valid field.', 'name' => 'LIST'], ['description' => 'Indicates this type is a non-null. ' . '`ofType` is a valid field.', 'name' => 'NON_NULL']]]]];
$this->assertEquals($expected, GraphQL::execute($schema, $request));
}