GraphQL\Tests\Type\DefinitionTest::testInputObjectTypeAllowsRecursiveDefinitions PHP Method

testInputObjectTypeAllowsRecursiveDefinitions() public method

    public function testInputObjectTypeAllowsRecursiveDefinitions()
    {
        $called = false;
        $inputObject = new InputObjectType(['name' => 'InputObject', 'fields' => function () use(&$inputObject, &$called) {
            $called = true;
            return ['value' => ['type' => Type::string()], 'nested' => ['type' => $inputObject]];
        }]);
        $someMutation = new ObjectType(['name' => 'SomeMutation', 'fields' => ['mutateSomething' => ['type' => $this->blogArticle, 'args' => ['input' => ['type' => $inputObject]]]]]);
        $schema = new Schema(['query' => $this->blogQuery, 'mutation' => $someMutation]);
        $this->assertTrue($called);
        $this->assertSame($inputObject, $schema->getType('InputObject'));
        $this->assertEquals(count($inputObject->getFields()), 2);
        $this->assertSame($inputObject->getField('nested')->getType(), $inputObject);
        $this->assertSame($someMutation->getField('mutateSomething')->getArg('input')->getType(), $inputObject);
    }