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

testThreadsContextCorrectly() public method

    public function testThreadsContextCorrectly()
    {
        // threads context correctly
        $doc = 'query Example { a }';
        $gotHere = false;
        $data = ['contextThing' => 'thing'];
        $ast = Parser::parse($doc);
        $schema = new Schema(['query' => new ObjectType(['name' => 'Type', 'fields' => ['a' => ['type' => Type::string(), 'resolve' => function ($context) use($doc, &$gotHere) {
            $this->assertEquals('thing', $context['contextThing']);
            $gotHere = true;
        }]]])]);
        Executor::execute($schema, $ast, $data, null, [], 'Example');
        $this->assertEquals(true, $gotHere);
    }