public function testAllowsShorthandFieldDefinition()
{
$interface = new InterfaceType(['name' => 'SomeInterface', 'fields' => function () use(&$interface) {
return ['value' => Type::string(), 'nested' => $interface, 'withArg' => ['type' => Type::string(), 'args' => ['arg1' => Type::int()]]];
}]);
$query = new ObjectType(['name' => 'Query', 'fields' => ['test' => $interface]]);
$schema = new Schema(['query' => $query]);
$valueField = $schema->getType('SomeInterface')->getField('value');
$nestedField = $schema->getType('SomeInterface')->getField('nested');
$this->assertEquals(Type::string(), $valueField->getType());
$this->assertEquals($interface, $nestedField->getType());
$withArg = $schema->getType('SomeInterface')->getField('withArg');
$this->assertEquals(Type::string(), $withArg->getType());
$this->assertEquals('arg1', $withArg->args[0]->name);
$this->assertEquals(Type::int(), $withArg->args[0]->getType());
$testField = $schema->getType('Query')->getField('test');
$this->assertEquals($interface, $testField->getType());
$this->assertEquals('test', $testField->name);
}