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

testFailsToExecuteQueryContainingTypeDefinition() public method

    public function testFailsToExecuteQueryContainingTypeDefinition()
    {
        $query = Parser::parse('
      { foo }

      type Query { foo: String }
    ');
        $schema = new Schema(['query' => new ObjectType(['name' => 'Query', 'fields' => ['foo' => ['type' => Type::string()]]])]);
        try {
            Executor::execute($schema, $query);
            $this->fail('Expected exception was not thrown');
        } catch (Error $e) {
            $this->assertEquals(['message' => 'GraphQL cannot execute a request containing a ObjectTypeDefinition.', 'locations' => [['line' => 4, 'column' => 7]]], $e->toSerializableArray());
        }
    }