GraphQL\Tests\Type\IntrospectionTest::testRespectsTheIncludeDeprecatedParameterForFields PHP Method

testRespectsTheIncludeDeprecatedParameterForFields() public method

    public function testRespectsTheIncludeDeprecatedParameterForFields()
    {
        $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
          trueFields: fields(includeDeprecated: true) {
            name
          }
          falseFields: fields(includeDeprecated: false) {
            name
          }
          omittedFields: fields {
            name
          }
        }
      }
        ';
        $expected = ['data' => ['__type' => ['name' => 'TestType', 'trueFields' => [['name' => 'nonDeprecated'], ['name' => 'deprecated']], 'falseFields' => [['name' => 'nonDeprecated']], 'omittedFields' => [['name' => 'nonDeprecated']]]]];
        $this->assertEquals($expected, GraphQL::execute($schema, $request));
    }