Fixed #19192 -- Allowed running tests with dummy db backend

Thanks Simon Charette for the initial patch, and Jan Bednařík for
his work on the ticket.