private function getTestSchema()
{
$StringBox = null;
$IntBox = null;
$SomeBox = null;
$SomeBox = new InterfaceType(['name' => 'SomeBox', 'resolveType' => function () use(&$StringBox) {
return $StringBox;
}, 'fields' => function () use(&$SomeBox) {
return ['deepBox' => ['type' => $SomeBox], 'unrelatedField' => ['type' => Type::string()]];
}]);
$StringBox = new ObjectType(['name' => 'StringBox', 'interfaces' => [$SomeBox], 'fields' => function () use(&$StringBox, &$IntBox) {
return ['scalar' => ['type' => Type::string()], 'deepBox' => ['type' => $StringBox], 'unrelatedField' => ['type' => Type::string()], 'listStringBox' => ['type' => Type::listOf($StringBox)], 'stringBox' => ['type' => $StringBox], 'intBox' => ['type' => $IntBox]];
}]);
$IntBox = new ObjectType(['name' => 'IntBox', 'interfaces' => [$SomeBox], 'fields' => function () use(&$StringBox, &$IntBox) {
return ['scalar' => ['type' => Type::int()], 'deepBox' => ['type' => $IntBox], 'unrelatedField' => ['type' => Type::string()], 'listStringBox' => ['type' => Type::listOf($StringBox)], 'stringBox' => ['type' => $StringBox], 'intBox' => ['type' => $IntBox]];
}]);
$NonNullStringBox1 = new InterfaceType(['name' => 'NonNullStringBox1', 'resolveType' => function () use(&$StringBox) {
return $StringBox;
}, 'fields' => ['scalar' => ['type' => Type::nonNull(Type::string())]]]);
$NonNullStringBox1Impl = new ObjectType(['name' => 'NonNullStringBox1Impl', 'interfaces' => [$SomeBox, $NonNullStringBox1], 'fields' => ['scalar' => ['type' => Type::nonNull(Type::string())], 'unrelatedField' => ['type' => Type::string()], 'deepBox' => ['type' => $SomeBox]]]);
$NonNullStringBox2 = new InterfaceType(['name' => 'NonNullStringBox2', 'resolveType' => function () use(&$StringBox) {
return $StringBox;
}, 'fields' => ['scalar' => ['type' => Type::nonNull(Type::string())]]]);
$NonNullStringBox2Impl = new ObjectType(['name' => 'NonNullStringBox2Impl', 'interfaces' => [$SomeBox, $NonNullStringBox2], 'fields' => ['scalar' => ['type' => Type::nonNull(Type::string())], 'unrelatedField' => ['type' => Type::string()], 'deepBox' => ['type' => $SomeBox]]]);
$Connection = new ObjectType(['name' => 'Connection', 'fields' => ['edges' => ['type' => Type::listOf(new ObjectType(['name' => 'Edge', 'fields' => ['node' => ['type' => new ObjectType(['name' => 'Node', 'fields' => ['id' => ['type' => Type::id()], 'name' => ['type' => Type::string()]]])]]]))]]]);
$schema = new Schema(['query' => new ObjectType(['name' => 'QueryRoot', 'fields' => ['someBox' => ['type' => $SomeBox], 'connection' => ['type' => $Connection]]]), 'types' => [$IntBox, $StringBox, $NonNullStringBox1Impl, $NonNullStringBox2Impl]]);
return $schema;
}