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

testThrowsIfNoOperationIsProvided() public method

    public function testThrowsIfNoOperationIsProvided()
    {
        $doc = 'fragment Example on Type { a }';
        $data = ['a' => 'b'];
        $ast = Parser::parse($doc);
        $schema = new Schema(['query' => new ObjectType(['name' => 'Type', 'fields' => ['a' => ['type' => Type::string()]]])]);
        try {
            Executor::execute($schema, $ast, $data);
            $this->fail('Expected exception was not thrown');
        } catch (Error $e) {
            $this->assertEquals('Must provide an operation.', $e->getMessage());
        }
    }