public static getIntrospectionQuery ( $includeDescription = true ) : string | ||
리턴 | string |
function testExecutesAnIntrospectionQuery() { $emptySchema = new Schema(new ObjectType(['name' => 'QueryRoot', 'fields' => []])); $request = Introspection::getIntrospectionQuery(false); $expected = array('data' => array('__schema' => array('mutationType' => NULL, 'queryType' => array('name' => 'QueryRoot'), 'types' => array(0 => array('kind' => 'OBJECT', 'name' => 'QueryRoot', 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL, 'fields' => []), 1 => array('kind' => 'OBJECT', 'name' => '__Schema', 'fields' => array(0 => array('name' => 'types', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Type')))), 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'queryType', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'mutationType', 'args' => array(), 'type' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'subscriptionType', 'args' => array(), 'type' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 4 => array('name' => 'directives', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Directive')))), 'isDeprecated' => false, 'deprecationReason' => NULL)), 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL), 2 => array('kind' => 'OBJECT', 'name' => '__Type', 'fields' => array(0 => array('name' => 'kind', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'ENUM', 'name' => '__TypeKind', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'name', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'description', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'fields', 'args' => array(0 => array('name' => 'includeDeprecated', 'type' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL), 'defaultValue' => 'false')), 'type' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Field', 'ofType' => NULL))), 'isDeprecated' => false, 'deprecationReason' => NULL), 4 => array('name' => 'interfaces', 'args' => array(), 'type' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL))), 'isDeprecated' => false, 'deprecationReason' => NULL), 5 => array('name' => 'possibleTypes', 'args' => array(), 'type' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL))), 'isDeprecated' => false, 'deprecationReason' => NULL), 6 => array('name' => 'enumValues', 'args' => array(0 => array('name' => 'includeDeprecated', 'type' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL), 'defaultValue' => 'false')), 'type' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__EnumValue', 'ofType' => NULL))), 'isDeprecated' => false, 'deprecationReason' => NULL), 7 => array('name' => 'inputFields', 'args' => array(), 'type' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__InputValue', 'ofType' => NULL))), 'isDeprecated' => false, 'deprecationReason' => NULL), 8 => array('name' => 'ofType', 'args' => array(), 'type' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL)), 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL), 3 => array('kind' => 'ENUM', 'name' => '__TypeKind', 'fields' => NULL, 'inputFields' => NULL, 'interfaces' => NULL, 'enumValues' => array(0 => array('name' => 'SCALAR', 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'OBJECT', 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'INTERFACE', 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'UNION', 'isDeprecated' => false, 'deprecationReason' => NULL), 4 => array('name' => 'ENUM', 'isDeprecated' => false, 'deprecationReason' => NULL), 5 => array('name' => 'INPUT_OBJECT', 'isDeprecated' => false, 'deprecationReason' => NULL), 6 => array('name' => 'LIST', 'isDeprecated' => false, 'deprecationReason' => NULL), 7 => array('name' => 'NON_NULL', 'isDeprecated' => false, 'deprecationReason' => NULL)), 'possibleTypes' => NULL), 4 => array('kind' => 'SCALAR', 'name' => 'String', 'fields' => NULL, 'inputFields' => NULL, 'interfaces' => NULL, 'enumValues' => NULL, 'possibleTypes' => NULL), 5 => array('kind' => 'SCALAR', 'name' => 'Boolean', 'fields' => NULL, 'inputFields' => NULL, 'interfaces' => NULL, 'enumValues' => NULL, 'possibleTypes' => NULL), 6 => array('kind' => 'OBJECT', 'name' => '__Field', 'fields' => array(0 => array('name' => 'name', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'description', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'args', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__InputValue')))), 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'type', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 4 => array('name' => 'isDeprecated', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 5 => array('name' => 'deprecationReason', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL)), 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL), 7 => array('kind' => 'OBJECT', 'name' => '__InputValue', 'fields' => array(0 => array('name' => 'name', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'description', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'type', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__Type', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'defaultValue', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL)), 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL), 8 => array('kind' => 'OBJECT', 'name' => '__EnumValue', 'fields' => array(0 => array('name' => 'name', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'description', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'isDeprecated', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'deprecationReason', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL)), 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL), 9 => array('kind' => 'OBJECT', 'name' => '__Directive', 'fields' => array(0 => array('name' => 'name', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 1 => array('name' => 'description', 'args' => array(), 'type' => array('kind' => 'SCALAR', 'name' => 'String', 'ofType' => NULL), 'isDeprecated' => false, 'deprecationReason' => NULL), 2 => array('name' => 'args', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'LIST', 'name' => NULL, 'ofType' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'OBJECT', 'name' => '__InputValue')))), 'isDeprecated' => false, 'deprecationReason' => NULL), 3 => array('name' => 'onOperation', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 4 => array('name' => 'onFragment', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL), 5 => array('name' => 'onField', 'args' => array(), 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)), 'isDeprecated' => false, 'deprecationReason' => NULL)), 'inputFields' => NULL, 'interfaces' => array(), 'enumValues' => NULL, 'possibleTypes' => NULL), 10 => ['kind' => 'SCALAR', 'name' => 'ID', 'fields' => null, 'inputFields' => null, 'interfaces' => null, 'enumValues' => null, 'possibleTypes' => null], 11 => ['kind' => 'SCALAR', 'name' => 'Float', 'fields' => null, 'inputFields' => null, 'interfaces' => null, 'enumValues' => null, 'possibleTypes' => null], 12 => ['kind' => 'SCALAR', 'name' => 'Int', 'fields' => null, 'inputFields' => null, 'interfaces' => null, 'enumValues' => null, 'possibleTypes' => null]), 'directives' => array(0 => array('name' => 'include', 'args' => array(0 => array('defaultValue' => NULL, 'name' => 'if', 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)))), 'onOperation' => false, 'onFragment' => true, 'onField' => true), 1 => array('name' => 'skip', 'args' => array(0 => array('defaultValue' => NULL, 'name' => 'if', 'type' => array('kind' => 'NON_NULL', 'name' => NULL, 'ofType' => array('kind' => 'SCALAR', 'name' => 'Boolean', 'ofType' => NULL)))), 'onOperation' => false, 'onFragment' => true, 'onField' => true))))); $actual = GraphQL::execute($emptySchema, $request); $this->assertEquals($expected, $actual); }
public function setUp() { $this->introQuery = new Source(Introspection::getIntrospectionQuery()); }
/** * @it can be introspected without error */ public function testCanBeIntrospectedWithoutError() { $result = GraphQL::execute($this->schema, Introspection::getIntrospectionQuery()); $this->assertArrayNotHasKey('errors', $result); }
protected function assertIntrospectionQuery($maxExpected) { $query = Introspection::getIntrospectionQuery(true); $this->assertMaxValue($query, $maxExpected); }