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

testThrowsIfNoOperationIsProvidedWithMultipleOperations() public method

    public function testThrowsIfNoOperationIsProvidedWithMultipleOperations()
    {
        $doc = 'query Example { a } query OtherExample { 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 is not thrown');
        } catch (Error $err) {
            $this->assertEquals('Must provide operation name if query contains multiple operations.', $err->getMessage());
        }
    }