GraphQL\Tests\Type\IntrospectionTest::testIntrospectsOnInputObject PHP Метод

testIntrospectsOnInputObject() публичный Метод

    function testIntrospectsOnInputObject()
    {
        $TestInputObject = new InputObjectType(['name' => 'TestInputObject', 'fields' => ['a' => ['type' => Type::string(), 'defaultValue' => 'foo'], 'b' => ['type' => Type::listOf(Type::string())], 'c' => ['type' => Type::string(), 'defaultValue' => null]]]);
        $TestType = new ObjectType(['name' => 'TestType', 'fields' => ['field' => ['type' => Type::string(), 'args' => ['complex' => ['type' => $TestInputObject]], 'resolve' => function ($_, $args) {
            return json_encode($args['complex']);
        }]]]);
        $schema = new Schema(['query' => $TestType]);
        $request = '
          {
            __schema {
              types {
                kind
                name
                inputFields {
                  name
                  type { ...TypeRef }
                  defaultValue
                }
              }
            }
          }

          fragment TypeRef on __Type {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
                ofType {
                  kind
                  name
                }
              }
            }
          }
        ';
        $expectedFragment = ['kind' => 'INPUT_OBJECT', 'name' => 'TestInputObject', 'inputFields' => [['name' => 'a', 'type' => ['kind' => 'SCALAR', 'name' => 'String', 'ofType' => null], 'defaultValue' => '"foo"'], ['name' => 'b', 'type' => ['kind' => 'LIST', 'name' => null, 'ofType' => ['kind' => 'SCALAR', 'name' => 'String', 'ofType' => null]], 'defaultValue' => null], ['name' => 'c', 'type' => ['kind' => 'SCALAR', 'name' => 'String', 'ofType' => null], 'defaultValue' => 'null']]];
        $result = GraphQL::execute($schema, $request);
        $result = $result['data']['__schema']['types'];
        // $this->assertEquals($expectedFragment, $result[1]);
        $this->assertContains($expectedFragment, $result);
    }