refactored querybuilder test to reuse quote replacement

fixes #5652