GraphQL\Tests\Executor\ExecutorTest::testProvidesInfoAboutCurrentExecutionState PHP Method

testProvidesInfoAboutCurrentExecutionState() public method

    public function testProvidesInfoAboutCurrentExecutionState()
    {
        $ast = Parser::parse('query ($var: String) { result: test }');
        /** @var ResolveInfo $info */
        $info = null;
        $schema = new Schema(['query' => new ObjectType(['name' => 'Test', 'fields' => ['test' => ['type' => Type::string(), 'resolve' => function ($val, $args, $ctx, $_info) use(&$info) {
            $info = $_info;
        }]]])]);
        $rootValue = ['root' => 'val'];
        Executor::execute($schema, $ast, $rootValue, null, ['var' => 123]);
        $this->assertEquals(['fieldName', 'fieldASTs', 'fieldNodes', 'returnType', 'parentType', 'path', 'schema', 'fragments', 'rootValue', 'operation', 'variableValues'], array_keys((array) $info));
        $this->assertEquals('test', $info->fieldName);
        $this->assertEquals(1, count($info->fieldNodes));
        $this->assertSame($ast->definitions[0]->selectionSet->selections[0], $info->fieldNodes[0]);
        $this->assertSame(Type::string(), $info->returnType);
        $this->assertSame($schema->getQueryType(), $info->parentType);
        $this->assertEquals(['result'], $info->path);
        $this->assertSame($schema, $info->schema);
        $this->assertSame($rootValue, $info->rootValue);
        $this->assertEquals($ast->definitions[0], $info->operation);
        $this->assertEquals(['var' => '123'], $info->variableValues);
    }