public function testIdentifiesDeprecatedFields()
{
$TestType = new ObjectType(['name' => 'TestType', 'fields' => ['nonDeprecated' => ['type' => Type::string()], 'deprecated' => ['type' => Type::string(), 'deprecationReason' => 'Removed in 1.0']]]);
$schema = new Schema(['query' => $TestType]);
$request = '
{
__type(name: "TestType") {
name
fields(includeDeprecated: true) {
name
isDeprecated,
deprecationReason
}
}
}
';
$expected = ['data' => ['__type' => ['name' => 'TestType', 'fields' => [['name' => 'nonDeprecated', 'isDeprecated' => false, 'deprecationReason' => null], ['name' => 'deprecated', 'isDeprecated' => true, 'deprecationReason' => 'Removed in 1.0']]]]];
$this->assertEquals($expected, GraphQL::execute($schema, $request));
}